[projectM] don't crash 'n burn if no presets are present
authorJonathan Marshall <jmarshall@never.you.mind>
Sat, 1 Dec 2012 07:06:28 +0000 (20:06 +1300)
committerJonathan Marshall <jmarshall@never.you.mind>
Sat, 1 Dec 2012 07:06:28 +0000 (20:06 +1300)
xbmc/visualizations/XBMCProjectM/Main.cpp

index 767aeba..50492d8 100644 (file)
@@ -363,7 +363,8 @@ bool InitProjectM()
     else
     {
       //If it is the first run or a newly chosen preset pack we choose a random preset as first
-      globalPM->selectPreset((rand() % (globalPM->getPlaylistSize())));
+      if (globalPM->getPlaylistSize())
+        globalPM->selectPreset((rand() % (globalPM->getPlaylistSize())));
     }
     return true;
   }