diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-01-22 18:33:55 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-01-22 18:33:55 +0100 |
| commit | 722c56e218d618543776dd99321adb694f4e90e7 (patch) | |
| tree | 877b9dbc618bf9fbf1d2316c4f6867d354c2179b /shortcuts | |
| parent | 92b3276d44e03888af0092c0ba18c6d89eb9e0e7 (diff) | |
ShortcutView: avoid crashes on null model
(bzr r2919.3.45)
Diffstat (limited to 'shortcuts')
| -rw-r--r-- | shortcuts/ShortcutModel.cpp | 1 | ||||
| -rw-r--r-- | shortcuts/ShortcutView.cpp | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/shortcuts/ShortcutModel.cpp b/shortcuts/ShortcutModel.cpp index 5d7ca81e3..8637eca41 100644 --- a/shortcuts/ShortcutModel.cpp +++ b/shortcuts/ShortcutModel.cpp @@ -50,7 +50,6 @@ void Model::AddHint(AbstractHint::Ptr const& hint) hints_[hint->category()].push_back(hint); } - void Model::Fill() { for (auto const& category : categories_) diff --git a/shortcuts/ShortcutView.cpp b/shortcuts/ShortcutView.cpp index cffc965e4..efc07d009 100644 --- a/shortcuts/ShortcutView.cpp +++ b/shortcuts/ShortcutView.cpp @@ -94,7 +94,9 @@ View::View() void View::SetModel(Model::Ptr model) { model_ = model; - model_->categories_per_column.changed.connect(sigc::hide(sigc::mem_fun(this, &View::RenderColumns))); + + if (model_) + model_->categories_per_column.changed.connect(sigc::hide(sigc::mem_fun(this, &View::RenderColumns))); // Fills the columns... RenderColumns(); @@ -206,6 +208,12 @@ void View::RenderColumns() { columns_layout_->Clear(); + if (!model_) + { + QueueRelayout(); + return; + } + int i = 0; int column_idx = 0; auto const& columns = columns_layout_->GetChildren(); |
