eitd: addEvent - fix possible segfault if lastEvent==NULL

Origin commit data
------------------
Branch: ni/coolstream
Commit: 1a1be2a82f
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2013-05-26 (Sun, 26 May 2013)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2013-05-26 18:44:52 +02:00
parent 681f1c1913
commit 2e816c19d0

View File

@@ -466,7 +466,7 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann
#else
time_t now = time(NULL);
bool back = false;
if ((*lastEvent)->times.size() == 1)
if (*lastEvent!=NULL && (*lastEvent)->times.size() == 1)
{
if ((*lastEvent)->times.begin()->startzeit + (long)(*lastEvent)->times.begin()->dauer >= now - oldEventsAre)
back = true;
@@ -489,7 +489,8 @@ xprintf("addEvent: ch %012" PRIx64 " running %d (%s) got_CN %d\n", evt.get_chann
}
// else fprintf(stderr, ">");
unlockEvents();
deleteEvent((*lastEvent)->uniqueKey());
if(*lastEvent!=NULL)
deleteEvent((*lastEvent)->uniqueKey());
}
else
unlockEvents();