]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextxml.cpp
generate size event when the dialog is shown for consistency with frames and other...
[wxWidgets.git] / src / richtext / richtextxml.cpp
index a9f803f49a69c36c5f4bbd27cb0d556d515f6a10..74d6bbf9d70103bc042ae2e3abc434fb65965175 100644 (file)
@@ -23,6 +23,7 @@
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
     #include "wx/module.h"
+    #include "wx/log.h"
 #endif
 
 #include "wx/filename.h"
@@ -172,10 +173,18 @@ bool wxRichTextXMLHandler::ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node)
             }
             else if (childName == wxT("image"))
             {
-                int imageType = wxBITMAP_TYPE_PNG;
+                wxBitmapType imageType = wxBITMAP_TYPE_PNG;
                 wxString value = node->GetAttribute(wxT("imagetype"), wxEmptyString);
                 if (!value.empty())
-                    imageType = wxAtoi(value);
+                {
+                    int type = wxAtoi(value);
+
+                    // note: 0 == wxBITMAP_TYPE_INVALID
+                    if (type <= 0 || type >= wxBITMAP_TYPE_MAX)
+                        wxLogWarning("Invalid bitmap type specified for <image> tag: %d", type);
+                    else
+                        imageType = (wxBitmapType)type;
+                }
 
                 wxString data;