]> git.lyx.org Git - lyx.git/commitdiff
Avoid null pointer dereference
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 20 Feb 2022 16:09:49 +0000 (17:09 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 20 Feb 2022 16:09:49 +0000 (17:09 +0100)
Spotted by coverity.

src/graphics/GraphicsLoader.cpp

index b375c0ec38534e9fd9acd73c24b1e0fb6b2f6ef6..dc3f7c5e357672e315934797408e5e4d0112693d 100644 (file)
@@ -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.