From 83d3abf2668c287e6079b0e09161dcf2b33403f8 Mon Sep 17 00:00:00 2001 From: Stefanos Kornilios Mitsis Poiitidis Date: Tue, 28 Jul 2015 16:27:27 +0200 Subject: [PATCH] maple: Gracefully fail if vmu cannot be written --- core/hw/maple/maple_devs.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/hw/maple/maple_devs.cpp b/core/hw/maple/maple_devs.cpp index 3bfe9f531..25499a731 100755 --- a/core/hw/maple/maple_devs.cpp +++ b/core/hw/maple/maple_devs.cpp @@ -286,8 +286,12 @@ struct maple_sega_vmu: maple_base { printf("Unable to open VMU save file \"%s\", creating new file\n",apath.c_str()); file=fopen(apath.c_str(),"wb"); - fwrite(flash_data, sizeof(flash_data), 1, file); - fseek(file,0,SEEK_SET); + if (file) { + fwrite(flash_data, sizeof(flash_data), 1, file); + fseek(file,0,SEEK_SET); + } else { + printf("Unable to create vmu\n"); + } } if (!file)