File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
src/android/nl/xservices/plugins Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -273,9 +273,12 @@ public void run() {
273273 }
274274 callback .sendPluginResult (new PluginResult (PluginResult .Status .OK , activeCalendars ));
275275 } catch (JSONException e ) {
276- System .err .println ("Exception : " + e .getMessage ());
276+ System .err .println ("JSONException : " + e .getMessage ());
277277 callback .error (e .getMessage ());
278- }
278+ } catch (Exception ex ) {
279+ System .err .println ("Exception: " + ex .getMessage ());
280+ callback .error (ex .getMessage ());
281+ }
279282 }
280283 });
281284 }
Original file line number Diff line number Diff line change @@ -288,7 +288,12 @@ public final JSONArray getActiveCalendars() throws JSONException {
288288 calendar .put ("id" , cursor .getString (cursor .getColumnIndex (this .getKey (KeyIndex .CALENDARS_ID ))));
289289 calendar .put ("name" , cursor .getString (cursor .getColumnIndex (this .getKey (KeyIndex .CALENDARS_NAME ))));
290290 calendar .put ("displayname" , cursor .getString (cursor .getColumnIndex (this .getKey (KeyIndex .CALENDARS_DISPLAY_NAME ))));
291- calendar .put ("isPrimary" , "1" .equals (cursor .getString (cursor .getColumnIndex (this .getKey (KeyIndex .IS_PRIMARY )))));
291+ int unReliableIsPrimaryIndex = cursor .getColumnIndex (this .getKey (KeyIndex .IS_PRIMARY ));
292+ if (unReliableIsPrimaryIndex >= 0 ){
293+ calendar .put ("isPrimary" , "1" .equals (cursor .getString (unReliableIsPrimaryIndex )));
294+ } else {
295+ calendar .put ("isPrimary" , false );
296+ }
292297 calendarsWrapper .put (calendar );
293298 } while (cursor .moveToNext ());
294299 cursor .close ();
You can’t perform that action at this time.
0 commit comments