X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/da1f16d6ef6f9433b9a5a3475541ebbf45c1ba72..b7f40ee2ad734d6081abf14347748a841c69d4b8:/client/cmddata.c diff --git a/client/cmddata.c b/client/cmddata.c index f263bbe9..169b0ace 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -2216,7 +2216,10 @@ int CmdLoad(const char *Cmd) GraphBuffer[GraphTraceLen] = atoi(line); GraphTraceLen++; } - fclose(f); + if (f) { + fclose(f); + f = NULL; + } PrintAndLog("loaded %d samples", GraphTraceLen); RepaintGraphWindow(); return 0; @@ -2290,7 +2293,10 @@ int CmdSave(const char *Cmd) for (i = 0; i < GraphTraceLen; i++) { fprintf(f, "%d\n", GraphBuffer[i]); } - fclose(f); + if (f) { + fclose(f); + f = NULL; + } PrintAndLog("saved to '%s'", Cmd); return 0; }