- if(opt == 'f' && param_getstr(Cmd, 1, filename) > 0)
- {
- f = fopen(filename, "rb");
- }else{
+ if(opt == 'f' && param_getstr(Cmd, 1, filename) > 0) {
+ if ( (f = fopen(filename, "rb")) == NULL) {
+ PrintAndLog("Could not find file %s", filename);
+ return 1;
+ }
+
+ } else {