]> git.saurik.com Git - wxWidgets.git/blobdiff - src/stc/stc.cpp
don't crash if one of GetAllCommands() parameters is NULL (coverity checker CID 11)
[wxWidgets.git] / src / stc / stc.cpp
index 86a9690efb7ffcfe82919a28c1cc80498690c6a8..ccf561d44cc63944bb3a8ace4ef82a049392e48a 100644 (file)
 
 #include <ctype.h>
 
-#include <wx/wx.h>
-#include <wx/tokenzr.h>
-#include <wx/mstream.h>
-#include <wx/image.h>
-#include <wx/file.h>
+#include "wx/wx.h"
+#include "wx/tokenzr.h"
+#include "wx/mstream.h"
+#include "wx/image.h"
+#include "wx/file.h"
 
 #include "wx/stc/stc.h"
 #include "ScintillaWX.h"
@@ -517,6 +517,8 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
         // convert bmp to a xpm in a string
         wxMemoryOutputStream strm;
         wxImage img = bmp.ConvertToImage();
+        if (img.HasAlpha())
+            img.ConvertAlphaToMask();
         img.SaveFile(strm, wxBITMAP_TYPE_XPM);
         size_t len = strm.GetSize();
         char* buff = new char[len+1];
@@ -896,6 +898,8 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
         // convert bmp to a xpm in a string
         wxMemoryOutputStream strm;
         wxImage img = bmp.ConvertToImage();
+        if (img.HasAlpha())
+            img.ConvertAlphaToMask();
         img.SaveFile(strm, wxBITMAP_TYPE_XPM);
         size_t len = strm.GetSize();
         char* buff = new char[len+1];