-rw-r--r-- | library/datebookdb.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp index 2ac9a0c..a26fe8f 100644 --- a/library/datebookdb.cpp +++ b/library/datebookdb.cpp @@ -724,25 +724,26 @@ void DateBookDB::loadFile( const QString &strFile ) dict.insert( "actionorig", new int (FJournalOrigHadRepeat) ); QByteArray ba = f.readAll(); char* dt = ba.data(); int len = ba.size(); int currentAction, journalKey, origHadRepeat; // should be bool, but we need tri-state(not being used) int i = 0; char *point; - while ( ( point = strstr( dt+i, "<event " ) ) != 0 ) { + // hack to get rid of segfaults after reading </DATEBOOK> + while ( (dt+i != 0) && (( point = strstr( dt+i, "<event " ) ) != 0 )) { i = point - dt; // if we are reading in events in the general case, // we are just adding them, so let the actions represent that... currentAction = ACTION_ADD; journalKey = -1; origHadRepeat = -1; // some temporary variables for dates and times ... //int startY = 0, startM = 0, startD = 0, starth = 0, startm = 0, starts = 0; //int endY = 0, endM = 0, endD = 0, endh = 0, endm = 0, ends = 0; //int enddtY = 0, enddtM = 0, enddtD = 0; // ... for the alarm settings ... |