]> git.lyx.org Git - lyx.git/commitdiff
#9875 add checks for having a current_view_ before using it
authorStephan Witt <switt@lyx.org>
Tue, 15 Dec 2015 00:14:53 +0000 (01:14 +0100)
committerStephan Witt <switt@lyx.org>
Tue, 15 Dec 2015 00:14:53 +0000 (01:14 +0100)
src/frontends/qt4/GuiApplication.cpp

index 8a5377f6294d3e8f9bd89e289fb4eafc61207733..b760da81edc7e65a56d9fe6c0417ab1b3e2bd8ad 100644 (file)
@@ -2160,7 +2160,8 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state)
                        // must not be inserted (#5704)
                        if (!isPrintable(encoded_last_key)) {
                                LYXERR(Debug::KEY, "Non-printable character! Omitting.");
-                               current_view_->restartCursor();
+                               if (current_view_)
+                                       current_view_->restartCursor();
                                return;
                        }
                        // If a non-Shift Modifier is used we have a non-bound key sequence
@@ -2173,9 +2174,12 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state)
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
                            && !(state & AltModifier && state & ControlModifier)
 #endif
-                           ) {
-                               current_view_->message(_("Unknown function."));
-                               current_view_->restartCursor();
+                           )
+                       {
+                               if (current_view_) {
+                                       current_view_->message(_("Unknown function."));
+                                       current_view_->restartCursor();
+                               }
                                return;
                        }
                        // Since all checks above were passed, we now really have text that