set snesadvance.dat path to rom dirname by default
authorJavier S. Pedro <maemo@javispedro.com>
Fri, 4 Sep 2009 16:47:43 +0000 (18:47 +0200)
committerJavier S. Pedro <maemo@javispedro.com>
Fri, 4 Sep 2009 16:47:43 +0000 (18:47 +0200)
platform/hgw.cpp

index 29a2cd2..5ffaed5 100644 (file)
@@ -105,7 +105,10 @@ void HgwConfig()
        }
        if (Settings.HacksEnabled && !Config.hacksFile) {
                // Provide a default speedhacks file
-               Config.hacksFile = asprintf("%s/snesadvance.dat", dirname(romFile));
+               if (asprintf(&Config.hacksFile, "%s/snesadvance.dat", dirname(romFile))
+                               < 0) {
+                       Config.hacksFile = 0; // malloc error.
+               }
                // romFile[] is garbled from now on.
        }