[LyX/master] Avoid null pointer dereference

Jean-Marc Lasgouttes lasgouttes at lyx.org
Sun Feb 20 15:37:21 UTC 2022


commit a900667ea1bb516ac562a6c45e4f3a1e4071b01b
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Sun Feb 20 17:09:49 2022 +0100

    Avoid null pointer dereference
    
    Spotted by coverity.
---
 src/graphics/GraphicsLoader.cpp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/graphics/GraphicsLoader.cpp b/src/graphics/GraphicsLoader.cpp
index b375c0e..dc3f7c5 100644
--- a/src/graphics/GraphicsLoader.cpp
+++ b/src/graphics/GraphicsLoader.cpp
@@ -400,7 +400,7 @@ void Loader::Impl::resetFile(FileName const & file)
 	// new file.
 	bool continue_monitoring = false;
 
-	if (!old_file.empty()) {
+	if (cached_item_ && !old_file.empty()) {
 		continue_monitoring = cached_item_->monitoring();
 		// cached_item_ is going to be reset, so the connected
 		// signal needs to be disconnected.


More information about the lyx-cvs mailing list