diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp index 5e9a6e894..75ec59ee8 100644 --- a/src/slic3r/GUI/GLTexture.cpp +++ b/src/slic3r/GUI/GLTexture.cpp @@ -518,6 +518,10 @@ bool GLTexture::generate_from_text(const std::string &text_str, wxFont &font, wx // prepare buffer std::vector data(4 * m_width * m_height, 0); const unsigned char* src = image.GetData(); + if (!src) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":font ConvertToImage error:\n" << text_str << "," << font.GetBaseFont().GetNativeFontInfoDesc().ToStdString(); + return false; + } /* for debug use std::ofstream fout; fout.open(text_str+std::to_string(m_width)+"_"+std::to_string(m_height)+".rgb", std::ios::out); @@ -596,6 +600,10 @@ bool GLTexture::generate_texture_from_text(const std::string& text_str, wxFont& // prepare buffer std::vector data(4 * m_width * m_height, 0); const unsigned char* src = image.GetData(); + if (!src) { + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":font ConvertToImage error:\n" << text_str << "," << font.GetBaseFont().GetNativeFontInfoDesc().ToStdString(); + return false; + } /* for debug use std::ofstream fout; fout.open(text_str+std::to_string(m_width)+"_"+std::to_string(m_height)+".rgb", std::ios::out); @@ -724,6 +732,7 @@ bool GLTexture::load_from_png(const std::string& filename, bool use_mipmaps, ECo unsigned char* img_rgb = image.GetData(); if (img_rgb == nullptr) { reset(); + BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ":load_from_png error\n"; return false; }