X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d47018c76133cf7013c1ef864481f21285c85d13..2bc44d6257f74b7f815d4a44014717b21dc20fd5:/src/richtext/richtextxml.cpp diff --git a/src/richtext/richtextxml.cpp b/src/richtext/richtextxml.cpp index a9f803f49a..74d6bbf9d7 100644 --- a/src/richtext/richtextxml.cpp +++ b/src/richtext/richtextxml.cpp @@ -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 tag: %d", type); + else + imageType = (wxBitmapType)type; + } wxString data;