--- a/src/qtgui/preview_w.cpp
+++ b/src/qtgui/preview_w.cpp
@@ -832,15 +832,15 @@
         // an ipath, create it.
         if (fn.empty() || !idoc.ipath.empty()) {
             TempFile temp = lthr.tmpimg;
-            if (temp) {
+            if (temp.ok()) {
                 LOGDEB1("Preview: load: got temp file from internfile\n");
             } else if (!FileInterner::idocToFile(temp, string(), 
                                                  theconfig, idoc)) {
-                temp.reset(); // just in case.
+                temp = TempFile(); // just in case.
             }
-            if (temp) {
+            if (temp.ok()) {
                 rememberTempFile(temp);
-                fn = temp->filename();
+                fn = temp.filename();
                 editor->m_tmpfilename = fn;
             } else {
                 editor->m_tmpfilename.erase();