From: Vincent van Ravesteijn Date: Fri, 22 Oct 2010 20:54:18 +0000 (+0000) Subject: Fix crashes and asserts if LyX doesn't have a view (on Mac for example). X-Git-Tag: 2.0.0~2291 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=d9c6263c6aab90ee195b62d408a192562914c94c;p=features.git Fix crashes and asserts if LyX doesn't have a view (on Mac for example). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35787 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 539169ba35..d592821cb4 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -1127,7 +1127,6 @@ void GuiApplication::dispatch(FuncRequest const & cmd) void GuiApplication::gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer) { - LASSERT(current_view_, /**/); if (!theSession().bookmarks().isValid(idx)) return; BookmarksSection::Bookmark const & bm = @@ -1367,7 +1366,8 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr) string lyx_name; string const x11_name = split(to_utf8(cmd.argument()), lyx_name, ' '); if (lyx_name.empty() || x11_name.empty()) { - current_view_->message( + if (current_view_) + current_view_->message( _("Syntax: set-color ")); break; } @@ -1702,7 +1702,8 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state) // Do nothing if we have nothing (JMarc) if (!keysym.isOK()) { LYXERR(Debug::KEY, "Empty kbd action (probably composing)"); - current_view_->restartCursor(); + if (current_view_) + current_view_->restartCursor(); return; } @@ -1745,7 +1746,7 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state) // why not return already here if action == -1 and // num_bytes == 0? (Lgb) - if (d->keyseq.length() > 1) + if (d->keyseq.length() > 1 && current_view_) current_view_->message(d->keyseq.print(KeySequence::ForGui)); @@ -1767,8 +1768,10 @@ void GuiApplication::processKeySym(KeySymbol const & keysym, KeyModifier state) FuncRequest::KEYBOARD); } else { LYXERR(Debug::KEY, "Unknown, !isText() - giving up"); - current_view_->message(_("Unknown function.")); - current_view_->restartCursor(); + if (current_view_) { + current_view_->message(_("Unknown function.")); + current_view_->restartCursor(); + } return; } }