fix `disk' method breakage when no automatic params provided at all
This commit is contained in:
parent
5dcaa44c82
commit
754c407115
11
automatic.c
11
automatic.c
@ -63,10 +63,11 @@ void grab_automatic_params(char * line)
|
||||
i++;
|
||||
}
|
||||
|
||||
tmp_params[p++].name = NULL;
|
||||
automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p);
|
||||
|
||||
log_message("AUTOMATIC MODE: got %d params", p-1);
|
||||
if (p) {
|
||||
tmp_params[p++].name = NULL;
|
||||
automatic_params = memdup(tmp_params, sizeof(struct param_elem) * p--);
|
||||
}
|
||||
log_message("AUTOMATIC MODE: got %d params", p);
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +75,7 @@ char * get_auto_value(char * auto_param)
|
||||
{
|
||||
struct param_elem * ptr = automatic_params;
|
||||
|
||||
while (ptr->name) {
|
||||
while (ptr && ptr->name) {
|
||||
if (!strcmp(ptr->name, auto_param))
|
||||
return ptr->value;
|
||||
ptr++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user