changeset 442:a67600e186d0

Fix probing to handle NULL probe functions.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 04 Nov 2012 06:41:10 +0200
parents 2a4de5fe4003
children f7c9d1619c74
files libgfx.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgfx.c	Sun Nov 04 06:40:35 2012 +0200
+++ b/libgfx.c	Sun Nov 04 06:41:10 2012 +0200
@@ -984,11 +984,14 @@
     for (i = 0; i < IMGFMT_LAST; i++)
     {
         DMImageFormat *fmt = &dmImageFormatList[i];
-        int score = fmt->probe(buf, len);
-        if (score > scoreMax)
+        if (fmt->probe != NULL)
         {
-            scoreMax = score;
-            scoreIndex = i;
+            int score = fmt->probe(buf, len);
+            if (score > scoreMax)
+            {
+                scoreMax = score;
+                scoreIndex = i;
+            }
         }
     }