Fix SIGSEGV on startup if ClutsDirectory is empty by always creating a model.

This commit is contained in:
Adam Reichold
2016-01-11 18:57:45 +01:00
parent 5ff270bf51
commit b8aa69c8d5
2 changed files with 8 additions and 9 deletions

View File

@@ -143,16 +143,15 @@ ClutComboBox::ClutColumns::ClutColumns()
add( clutFilename );
}
int ClutComboBox::fillFromDir( Glib::ustring path )
int ClutComboBox::fillFromDir (const Glib::ustring& path)
{
int result = 0;
m_model = Gtk::TreeStore::create (m_columns);
set_model (m_model);
if ( !path.empty() ) {
m_model.clear();
m_model = Gtk::TreeStore::create( m_columns );
set_model( m_model );
result = parseDir( path, 0 );
pack_start( m_columns.label, false );
const auto result = parseDir (path, nullptr);
if (result > 0) {
pack_start (m_columns.label, false);
}
return result;

View File

@@ -11,7 +11,7 @@
class ClutComboBox : public MyComboBox
{
public:
int fillFromDir( Glib::ustring path );
int fillFromDir (const Glib::ustring& path);
Glib::ustring getSelectedClut();
void setSelectedClut( Glib::ustring filename );
void addUnchangedEntry();