summaryrefslogtreecommitdiff
path: root/src/gui/table.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/table.cpp')
-rw-r--r--src/gui/table.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 89a93825..bddfbfed 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -105,8 +105,10 @@ GuiTable::setModel(TableModel *new_model)
mModel = new_model;
installActionListeners();
- new_model->installListener(this);
- recomputeDimensions();
+ if (new_model) {
+ new_model->installListener(this);
+ recomputeDimensions();
+ }
}
@@ -187,6 +189,9 @@ GuiTable::uninstallActionListeners(void)
void
GuiTable::installActionListeners(void)
{
+ if (!mModel)
+ return;
+
int rows = mModel->getRows();
int columns = mModel->getColumns();
@@ -367,7 +372,7 @@ GuiTable::getWidgetAt(int x, int y)
if (row > -1
&& column > -1) {
gcn::Widget *w = mModel->getElementAt(row, column);
- if (w->isFocusable())
+ if (w && w->isFocusable())
return w;
else
return NULL; // Grab the event locally