Fixed a file handle leak.

This commit is contained in:
bubnikv 2019-12-20 17:29:23 +01:00
parent cf0697b5f2
commit a0d47bf167

View file

@ -433,17 +433,15 @@ static std::string icon_name_respected_to_mode(const std::string& bmp_name_in)
#else #else
const std::string folder = "white/"; const std::string folder = "white/";
#endif #endif
std::string bmp_name = Slic3r::GUI::wxGetApp().dark_mode() ? folder + bmp_name_in : bmp_name_in; std::string bmp_name;
boost::replace_last(bmp_name, ".png", ""); if (Slic3r::GUI::wxGetApp().dark_mode()) {
FILE* fp = NULL; bmp_name = folder + bmp_name_in;
fp = boost::nowide::fopen(Slic3r::var(bmp_name + ".svg").c_str(), "rb"); boost::replace_last(bmp_name, ".png", "");
if (!fp) }
{ if (bmp_name.empty()) {
bmp_name = bmp_name_in; bmp_name = bmp_name_in;
boost::replace_last(bmp_name, ".png", ""); boost::replace_last(bmp_name, ".png", "");
if (fp) fclose(fp); }
}
return bmp_name; return bmp_name;
} }