VmaDumpVis: Gracefully handle cases where there is nothing to put on the image, e.g. the stats string was generated without detailed map enabled

Message is printed in that case and 1 is returned instead of division by zero error.
Closes #125
diff --git a/tools/VmaDumpVis/VmaDumpVis.py b/tools/VmaDumpVis/VmaDumpVis.py
index f5a38b1..519ee30 100644
--- a/tools/VmaDumpVis/VmaDumpVis.py
+++ b/tools/VmaDumpVis/VmaDumpVis.py
@@ -66,6 +66,20 @@
         return newMemTypeData

 

 

+def IsDataEmpty():

+    global data

+    for dictMemType in data.values():

+        if 'DedicatedAllocations' in dictMemType and len(dictMemType['DedicatedAllocations']) > 0:

+            return False

+        if 'DefaultPoolBlocks' in dictMemType and len(dictMemType['DefaultPoolBlocks']) > 0:

+            return False

+        if 'CustomPools' in dictMemType:

+            for lBlockList in dictMemType['CustomPools'].values():

+                if len(lBlockList) > 0:

+                    return False

+    return True

+

+

 # Returns tuple:

 # [0] image height : integer

 # [1] pixels per byte : float

@@ -204,6 +218,10 @@
         for sBlockId, objBlock in objBlocks.items():

             ProcessBlock(dstBlockArray, int(sBlockId), objBlock, sAlgorithm)

 

+if IsDataEmpty():

+    print("There is nothing to put on the image. Please make sure you generated the stats string with detailed map enabled.")

+    exit(1)

+

 iImgSizeY, fPixelsPerByte = CalcParams()

 

 img = Image.new('RGB', (IMG_SIZE_X, iImgSizeY), 'white')