[haiku-commits] r40692 - haiku/trunk/src/apps/showimage

  • From: philippe.houdoin@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 26 Feb 2011 02:37:44 +0100 (CET)

Author: phoudoin
Date: 2011-02-26 02:37:44 +0100 (Sat, 26 Feb 2011)
New Revision: 40692
Changeset: http://dev.haiku-os.org/changeset/40692
Ticket: http://dev.haiku-os.org/ticket/6842

Modified:
   haiku/trunk/src/apps/showimage/ImageCache.cpp
Log:
Fix ShowImage crash when image loading fail: we don't have a CacheEntry then, 
but still 
should notify our listener (of the error, in such case).
Closes #6842.


Modified: haiku/trunk/src/apps/showimage/ImageCache.cpp
===================================================================
--- haiku/trunk/src/apps/showimage/ImageCache.cpp       2011-02-26 00:10:36 UTC 
(rev 40691)
+++ haiku/trunk/src/apps/showimage/ImageCache.cpp       2011-02-26 01:37:44 UTC 
(rev 40692)
@@ -318,7 +318,7 @@
 
        std::set<BMessenger>::iterator iterator = queueEntry->listeners.begin();
        for (; iterator != queueEntry->listeners.end(); iterator++) {
-               if (iterator->SendMessage(&notification) == B_OK) {
+               if (iterator->SendMessage(&notification) == B_OK && entry != 
NULL) {
                        entry->bitmapOwner->AcquireReference();
                                // this is the reference owned by the target
                }
@@ -335,7 +335,7 @@
        BMessage notification(kMsgImageCacheImageLoaded);
        _BuildNotification(entry, notification);
 
-       if (target->SendMessage(&notification) == B_OK) {
+       if (target->SendMessage(&notification) == B_OK && entry != NULL) {
                entry->bitmapOwner->AcquireReference();
                        // this is the reference owned by the target
        }


Other related posts: