[LyX/master] Do not access current_view_ if it is NULL

Jean-Marc Lasgouttes lasgouttes at lyx.org
Mon Sep 9 13:40:31 UTC 2024


commit ffde470363c0bfafc915751fa788a34d4c9e06b8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Mon Sep 9 15:35:57 2024 +0200

    Do not access current_view_ if it is NULL
    
    Spotted by Coverity scan.
---
 src/frontends/qt/GuiApplication.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/frontends/qt/GuiApplication.cpp b/src/frontends/qt/GuiApplication.cpp
index a4c8b328b3..1c9edc0c9c 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -1902,7 +1902,8 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 			// set default
 			arg = "templates";
 		if (arg != "templates" && arg != "examples") {
-			current_view_->message(_("Wrong argument. Must be 'examples' or 'templates'."));
+			if (current_view_)
+				current_view_->message(_("Wrong argument. Must be 'examples' or 'templates'."));
 			break;
 		}
 		lyx::dispatch(FuncRequest(LFUN_DIALOG_SHOW, "lyxfiles " + arg));


More information about the lyx-cvs mailing list