fix `disk' method breakage when no automatic params provided at all

This commit is contained in:
Sergey Bolshakov 2008-08-25 16:24:53 +04:00
parent 5dcaa44c82
commit 754c407115

View File

@ -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++;