]> git.lyx.org Git - features.git/commitdiff
Use assertions to declare things we know for sure
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 5 Apr 2017 09:53:17 +0000 (11:53 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Wed, 5 Apr 2017 09:53:17 +0000 (11:53 +0200)
Doing it that way makes coverity happy.

src/frontends/qt4/GuiView.cpp

index be9425ba34dd9fc212b46c0edb54d9935909c730..7bfb7cc54696854e92c2b609c39045239e695318 100644 (file)
@@ -1935,7 +1935,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                else if (name == "latexlog")
                        enable = FileName(doc_buffer->logName()).isReadableFile();
                else if (name == "spellchecker")
-                       enable = theSpellChecker() 
+                       enable = theSpellChecker()
                                && !doc_buffer->isReadonly()
                                && !doc_buffer->text().empty();
                else if (name == "vclog")
@@ -3854,6 +3854,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                                if (!data.empty())
                                        showDialog("character", data);
                        } else if (name == "latexlog") {
+                               // getStatus checks that
+                               LATTEST(doc_buffer);
                                Buffer::LogType type;
                                string const logfile = doc_buffer->logName(&type);
                                switch (type) {
@@ -3867,6 +3869,8 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                                data += Lexer::quoteString(logfile);
                                showDialog("log", data);
                        } else if (name == "vclog") {
+                               // getStatus checks that
+                               LATTEST(doc_buffer);
                                string const data = "vc " +
                                        Lexer::quoteString(doc_buffer->lyxvc().getLogFile());
                                showDialog("log", data);