]> git.lyx.org Git - lyx.git/blobdiff - src/graphics/GraphicsLoader.cpp
de.po: fix doubled accelerator keys
[lyx.git] / src / graphics / GraphicsLoader.cpp
index 63b1ac4f188521c62ea0e9f020d4b15eb93f8832..ecc9cd9e03959374d33b429257217ff351303ffe 100644 (file)
@@ -407,9 +407,20 @@ void Loader::Impl::statusChanged()
 
 void Loader::Impl::createPixmap()
 {
-       if (!cached_item_.get() || !params_.display || status_ != Loaded)
+       if (!params_.display || status_ != Loaded)
                return;
 
+       if (!cached_item_.get()) {
+               LYXERR(Debug::GRAPHICS, "pixmap not cached yet");
+               return;
+       }
+
+       if (!cached_item_->image()) {
+               // There must have been a problem reading the file.
+               LYXERR(Debug::GRAPHICS, "Graphics file not loaded.");
+               return;
+       }
+
        image_.reset(cached_item_->image()->clone());
 
        bool const success = image_->setPixmap(params_);
@@ -427,8 +438,11 @@ void Loader::Impl::startLoading()
        if (status_ != WaitingToLoad)
                return;
 
-       if (cached_item_->tryDisplayFormat())
+       if (cached_item_->tryDisplayFormat()) {
+               status_ = Loaded;
+               createPixmap();
                return;
+       }
 
        LoaderQueue::get().touch(cached_item_);
 }