[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepimlibs/KDE/4.11] akonadi/calendar: Don't segfault in release mode.
From:       Sergio Martins <iamsergio () gmail ! com>
Date:       2013-11-18 11:45:15
Message-ID: E1ViNGV-0008AY-KC () scm ! kde ! org
[Download RAW message or body]

Git commit e373e8622c7fae281de947d371157a26aac21b9a by Sergio Martins.
Committed on 18/11/2013 at 11:42.
Pushed by smartins into branch 'KDE/4.11'.

Don't segfault in release mode.

I'm not removing the assert because this shouldn't happen, but
lets not segfault in release mode.

BUG: 327755

M  +7    -1    akonadi/calendar/calendarbase.cpp

http://commits.kde.org/kdepimlibs/e373e8622c7fae281de947d371157a26aac21b9a

diff --git a/akonadi/calendar/calendarbase.cpp b/akonadi/calendar/calendarbase.cpp
index 3a93e7d..40e72c6 100644
--- a/akonadi/calendar/calendarbase.cpp
+++ b/akonadi/calendar/calendarbase.cpp
@@ -291,7 +291,13 @@ void CalendarBasePrivate::handleUidChange(const Akonadi::Item &oldItem,
 
   // Get the real pointer
   oldIncidence = q->MemoryCalendar::incidence( oldIncidence->uid() );
-  Q_ASSERT( oldIncidence );
+
+  if ( !oldIncidence ) {
+    // How can this happen ?
+    kWarning() << "Couldn't find old incidence";
+    Q_ASSERT( false );
+    return;
+  }
 
   if ( newIncidence->instanceIdentifier() == oldIncidence->instanceIdentifier() ) {
     kWarning() << "New uid=" << newIncidence->uid() << "; old uid=" << oldIncidence->uid()
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic