randpkt: choose a random type if the empty string has been selected as type.
Fixes a bug when calling randpktdump without the dialog. Reproducer: Open wireshark Double click on randpktdump Stop the capture No packets have been generated. Change-Id: I43d1d3c02afbb44f88620a696a7d25aa4e45889a Reviewed-on: https://code.wireshark.org/review/22775 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
1e584b8a13
commit
17f72a0b22
|
@ -698,8 +698,8 @@ int randpkt_parse_type(char *string)
|
|||
int num_entries = array_length(examples);
|
||||
int i;
|
||||
|
||||
/* Called with NULL, choose a random packet */
|
||||
if (!string) {
|
||||
/* If called with NULL, or empty string, choose a random packet */
|
||||
if (!string || !g_strcmp0(string, "")) {
|
||||
return examples[g_random_int_range(0, num_entries)].produceable_type;
|
||||
}
|
||||
|
||||
|
@ -710,7 +710,7 @@ int randpkt_parse_type(char *string)
|
|||
}
|
||||
|
||||
/* Complain */
|
||||
fprintf(stderr, "randpkt: Type %s not known.\n", string);
|
||||
g_error("randpkt: Type %s not known.\n", string);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue