Only call wtap_dump_close() if we have an open file.
We can have a situation where a file only contains a valid file header without any packages, so this will avoid a crash. svn path=/trunk/; revision=28602
This commit is contained in:
parent
7e6d072ce7
commit
fa71489b83
|
@ -1250,9 +1250,9 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (!wtap_dump_close(pdh, &err)) {
|
||||
if (pdh && !wtap_dump_close(pdh, &err)) {
|
||||
|
||||
fprintf(stderr, "editcap: Error writing to %s: %s\n", filename,
|
||||
fprintf(stderr, "editcap: Error closing %s: %s\n", filename,
|
||||
wtap_strerror(err));
|
||||
exit(2);
|
||||
|
||||
|
|
Loading…
Reference in New Issue