Fix for NPE

This commit is contained in:
Moxie Marlinspike 2014-02-26 12:42:16 -08:00
parent 5a62856e46
commit 3b25b87aa8

View File

@ -22,6 +22,7 @@ import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
@ -408,7 +409,10 @@ public class PartDatabase extends Database {
cursor = database.query(TABLE_NAME, new String[] {DATA}, MMS_ID + " = ?", new String[] {mmsId+""}, null, null, null); cursor = database.query(TABLE_NAME, new String[] {DATA}, MMS_ID + " = ?", new String[] {mmsId+""}, null, null, null);
while (cursor != null && cursor.moveToNext()) { while (cursor != null && cursor.moveToNext()) {
new File(cursor.getString(0)).delete(); String data = cursor.getString(0);
if (!TextUtils.isEmpty(data)) {
new File(cursor.getString(0)).delete();
}
} }
} finally { } finally {
if (cursor != null) if (cursor != null)