safeguard against crash upon buggy input

This commit is contained in:
Holger Vogt 2023-05-17 09:32:23 +02:00
parent 2206956bc1
commit b271b6d9e3
1 changed files with 5 additions and 1 deletions

View File

@ -4483,7 +4483,8 @@ static int inp_get_param_level(
return level; return level;
} }
/* Return the number of terminals for a given device, characterized by
the first letter of its instance line. Returns 0 upon error. */
int get_number_terminals(char *c) int get_number_terminals(char *c)
{ {
int i, j, k; int i, j, k;
@ -4491,6 +4492,9 @@ int get_number_terminals(char *c)
char nam_buf[128]; char nam_buf[128];
bool area_found = FALSE; bool area_found = FALSE;
if (!c)
return 0;
switch (*c) { switch (*c) {
case 'r': case 'r':
case 'c': case 'c':