changeset 1423:065dedf5890e

Fix view64 window title updating.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 08 Nov 2017 02:37:01 +0200
parents 3b71aa1ef915
children b09a9457ffe3
files tools/view64.c
diffstat 1 files changed, 11 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/tools/view64.c	Wed Nov 08 01:31:03 2017 +0200
+++ b/tools/view64.c	Wed Nov 08 02:37:01 2017 +0200
@@ -390,7 +390,7 @@
             char *filename = optFilenames[currIndex];
             const DMC64ImageFormat *fmt = NULL;
             DMC64Image *cimage = NULL;
-            char *title;
+            char *title = NULL;
 
             if (surf != NULL)
             {
@@ -426,18 +426,6 @@
 
                 dmDumpC64Image(filename, cimage, fmt);
             }
-            else
-            {
-                title = dm_strdup_printf("%s [%d / %d]",
-                    dmProgName,
-                    currIndex + 1, noptFilenames2);
-            }
-
-            if (title != NULL)
-            {
-                SDL_WM_SetCaption(title, dmProgName);
-                dmFree(title);
-            }
 
 fail:
             if (surf == NULL && (surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 320, 200, 8, 0, 0, 0, 0)) == NULL)
@@ -446,6 +434,16 @@
                 goto exit;
             }
 
+            if (title == NULL)
+            {
+                title = dm_strdup_printf("%s [%d / %d]",
+                    dmProgName,
+                    currIndex + 1, noptFilenames2);
+            }
+
+            SDL_WM_SetCaption(title, dmProgName);
+            dmFree(title);
+
             needRedraw = TRUE;
             prevIndex = currIndex;
         }