--- sd/source/ui/toolpanel/controls/MasterPageObserver.cxx.orig	2007-04-20 19:02:21.000000000 +0200
+++ sd/source/ui/toolpanel/controls/MasterPageObserver.cxx	2007-04-20 19:03:03.000000000 +0200
@@ -234,7 +234,10 @@
 {
     EndListening (rDocument);
 
-    maUsedMasterPages.erase(maUsedMasterPages.find(&rDocument));
+    MasterPageContainer::iterator aMasterPageDescriptor (
+        maUsedMasterPages.find(&rDocument));
+    if (aMasterPageDescriptor != maUsedMasterPages.end())
+        maUsedMasterPages.erase(aMasterPageDescriptor);
 }
 
 
