std::string(char*) crashes if it's given a nullptr.

pull/1191/head
John Ralls 5 years ago
parent b6622a386b
commit f0ecc0e2eb

@ -2320,8 +2320,11 @@ public:
{
auto string = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(get_widget()));
DEBUG("filename %s", string ? string : "(null)");
option.set_value(std::string{string});
g_free(string);
if (string)
{
option.set_value(std::string{string});
g_free(string);
}
}
};

Loading…
Cancel
Save