Fix for NPE that user reported, also made calendar picking logic more robust.

pull/14/head
Tim Su 15 years ago
parent b11df0aa95
commit 4de8134091

@ -320,7 +320,9 @@ public class TagController extends AbstractController {
/** Closes database resource */
@Override
public void close() {
if(tagDatabase != null)
tagDatabase.close();
if(tagToTaskMapDatabase != null)
tagToTaskMapDatabase.close();
}
}

@ -86,7 +86,7 @@ public class Calendars {
int currentSettingIndex = -1;
if (c == null) {
if (c == null || c.getCount() == 0) {
// Something went wrong when querying calendars
// Let's keep the "Astrid default" only.
listPreference
@ -104,7 +104,6 @@ public class Calendars {
String[] entries = new String[calendarCount];
String[] entryValues = new String[calendarCount];
// Iterate calendars one by one, and fill up the list preference
try {
int row = 0;
@ -135,6 +134,8 @@ public class Calendars {
.getString(R.string.prefs_defaultCalendar_default) });
listPreference.setValueIndex(0);
listPreference.setEnabled(true);
} else if(currentSettingIndex >= entryValues.length) {
currentSettingIndex = 0;
}
listPreference.setEntries(entries);

Loading…
Cancel
Save