diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 2ce2de6998..c3db0821b4 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -736,14 +736,15 @@ bool GuiViewBase::event(QEvent * e) //case QEvent::Drop: // break; - case QEvent::WindowActivate: { - GuiWorkArea * wa = dynamic_cast(d.tab_widget_->currentWidget()); - BOOST_ASSERT(wa); - BufferView & bv = wa->bufferView(); - connectBufferView(bv); - connectBuffer(bv.buffer()); + case QEvent::WindowActivate: + if (d.tab_widget_->count()) { + GuiWorkArea * wa = dynamic_cast(d.tab_widget_->currentWidget()); + BOOST_ASSERT(wa); + BufferView & bv = wa->bufferView(); + connectBufferView(bv); + connectBuffer(bv.buffer()); + } return QMainWindow::event(e); - } case QEvent::ShortcutOverride: { QKeyEvent * ke = static_cast(e);