X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/16a9209c042b33d23cf85d07699e8d026e7b288b..5b8167fb97892f1d2db47a4e986bf90573f7beec:/client/cmddata.c?ds=inline 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; }