Skip to content

Commit

Permalink
Merge pull request #106 from woheller69/master
Browse files Browse the repository at this point in the history
Bugfixes
  • Loading branch information
woheller69 authored Sep 16, 2024
2 parents 6e7c13a + ca28941 commit 0c3940b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,14 @@ private List<VEvent> getEvents(ContentResolver resolver, AndroidCalendar cal_src
String where = Events.CALENDAR_ID + "=? AND deleted=0";
String[] args = new String[] { cal_src.mIdStr };
String sortBy = Events.CALENDAR_ID + " ASC";
Cursor cur;
Cursor cur = null;

try {
cur = resolver.query(Events.CONTENT_URI, mAllCols ? null : EVENT_COLS,
where, args, sortBy);
} catch (Exception except) {
where, args, sortBy);
} catch (Exception ignored) {}

if (cur == null) {
Log.w(TAG, "Calendar provider is missing columns, continuing anyway");
int n = 0;
for (n = 0; n < EVENT_COLS.length; ++n)
Expand All @@ -249,18 +252,22 @@ private List<VEvent> getEvents(ContentResolver resolver, AndroidCalendar cal_src
//TW: _sync_id=1611333603291 pro Event? oder: secTimeStamp=1611334074922

// Collect up events and add them after any timezones
setMax(cur.getCount());
List<VEvent> events = new ArrayList<>();
while (cur.moveToNext()) {
incrementProgress();
VEvent e = convertFromDb(cur, cal_dst, timestamp);
if (e != null) {
events.add(e);
if (Log.getIsUserEnabled())
Log.d(TAG, "Adding event: " + e.toString());

if (cur != null) {
setMax(cur.getCount());
while (cur.moveToNext()) {
incrementProgress();
VEvent e = convertFromDb(cur, cal_dst, timestamp);
if (e != null) {
events.add(e);
if (Log.getIsUserEnabled())
Log.d(TAG, "Adding event: " + e.toString());
}
}
cur.close();
}
cur.close();

return events;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public void onClick(DialogInterface iface, int id) {
boolean found = false;
for (int i = 0; i < mCalendars.size(); i++) {
if (mCalendars.get(i).mId == mIntentCalendarId &&
(calendarName == null || mCalendars.get(i).mName.contentEquals(calendarName))) {
(calendarName == null || (mCalendars.get(i).mName != null && mCalendars.get(i).mName.contentEquals(calendarName)))) {
found = true;
final int index = i;
runOnUiThread(new Runnable() {
Expand Down

0 comments on commit 0c3940b

Please sign in to comment.