Commits

Anonymous committed e4298f9 Draft

Attempt to fix random force close

Comments (0)

Files changed (1)

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;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.