Fix small corner case errors from crash logs

git-svn-id: https://zxing.googlecode.com/svn/trunk@2363 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2012-07-31 17:06:20 +00:00
parent 53ace36930
commit 1fbad444ee
3 changed files with 9 additions and 7 deletions

View file

@ -70,11 +70,13 @@ final class BookmarkAdapter extends BaseAdapter {
layout = (LinearLayout) factory.inflate(R.layout.bookmark_picker_list_item, viewGroup, false);
}
cursor.moveToPosition(index);
String title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN);
((TextView) layout.findViewById(R.id.bookmark_title)).setText(title);
String url = cursor.getString(BookmarkPickerActivity.URL_COLUMN);
((TextView) layout.findViewById(R.id.bookmark_url)).setText(url);
if (!cursor.isClosed()) {
cursor.moveToPosition(index);
String title = cursor.getString(BookmarkPickerActivity.TITLE_COLUMN);
((TextView) layout.findViewById(R.id.bookmark_title)).setText(title);
String url = cursor.getString(BookmarkPickerActivity.URL_COLUMN);
((TextView) layout.findViewById(R.id.bookmark_url)).setText(url);
} // Otherwise... just don't update as the object is shutting down
return layout;
}
}

View file

@ -65,7 +65,7 @@ public final class BookmarkPickerActivity extends ListActivity {
@Override
protected void onListItemClick(ListView l, View view, int position, long id) {
if (cursor.moveToPosition(position)) {
if (!cursor.isClosed() && cursor.moveToPosition(position)) {
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
intent.putExtra(Browser.BookmarkColumns.TITLE, cursor.getString(TITLE_COLUMN));

View file

@ -314,7 +314,7 @@ public final class VCardResultParser extends ResultParser {
int start = 0;
int end;
int componentIndex = 0;
while ((end = name.indexOf(';', start)) > 0) {
while (componentIndex < components.length - 1 && (end = name.indexOf(';', start)) > 0) {
components[componentIndex] = name.substring(start, end);
componentIndex++;
start = end + 1;