Commits

JRummy16  committed e4298f9 Draft

Attempt to fix random force close

  • Participants
  • Parent commits 61a7406

Comments (0)

Files changed (1)

File src/com/jrummy/busybox/installer/Scripter.java

 import android.app.Activity;
 import android.content.Context;
 import android.database.Cursor;
+import android.database.CursorIndexOutOfBoundsException;
 import android.os.Handler;
 import android.os.Looper;
 import android.os.Message;
 		Cursor cursor = mDbHelper.fetchAllScripts();
 		cursor.moveToFirst();
 		do {
-			Script script = new Script();
-			int rowId = cursor.getInt(ScripterDB.INDEX_ROWID);
-			String name = cursor.getString(ScripterDB.INDEX_SCRIPT_NAME);
-			String commands = cursor.getString(ScripterDB.INDEX_COMMANDS);
-			long lastRunTime = cursor.getLong(ScripterDB.INDEX_LAST_RUNTIME);
-			int setOnBoot = cursor.getInt(ScripterDB.INDEX_SET_ON_BOOT);
-			script.setName(name);
-			script.setCommands(commands);
-			script.setLastRunTime(lastRunTime);
-			script.setRowId(rowId);
-			script.setSetOnBoot(setOnBoot == 1);
-			scripts.add(script);
+			try {
+				Script script = new Script();
+				int rowId = cursor.getInt(ScripterDB.INDEX_ROWID);
+				String name = cursor.getString(ScripterDB.INDEX_SCRIPT_NAME);
+				String commands = cursor.getString(ScripterDB.INDEX_COMMANDS);
+				long lastRunTime = cursor.getLong(ScripterDB.INDEX_LAST_RUNTIME);
+				int setOnBoot = cursor.getInt(ScripterDB.INDEX_SET_ON_BOOT);
+				script.setName(name);
+				script.setCommands(commands);
+				script.setLastRunTime(lastRunTime);
+				script.setRowId(rowId);
+				script.setSetOnBoot(setOnBoot == 1);
+				scripts.add(script);
+			} catch (CursorIndexOutOfBoundsException e) {
+				Log.i(TAG, "Failed getting script", e);
+			}
 		} while (cursor.moveToNext());
 		mDbHelper.close();
 		return scripts;