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 ); 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() ) { const auto result = parseDir (path, nullptr);
m_model.clear();
m_model = Gtk::TreeStore::create( m_columns ); if (result > 0) {
set_model( m_model ); pack_start (m_columns.label, false);
result = parseDir( path, 0 );
pack_start( m_columns.label, false );
} }
return result; return result;

View File

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