X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/16a9209c042b33d23cf85d07699e8d026e7b288b..53f7c75a38a18e79313e7bd5f664a11a73db5307:/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; }