handle nulls in event_prefix and label_format in Monitor::Reload

This commit is contained in:
Isaac Connor 2018-01-16 11:08:35 -05:00
parent 45ee7284f5
commit 26cea49f1a
1 changed files with 14 additions and 2 deletions

View File

@ -1727,8 +1727,20 @@ void Monitor::Reload() {
function = (Function)atoi(dbrow[index++]); function = (Function)atoi(dbrow[index++]);
enabled = atoi(dbrow[index++]); enabled = atoi(dbrow[index++]);
const char *p_linked_monitors = dbrow[index++]; const char *p_linked_monitors = dbrow[index++];
if ( dbrow[index] ) {
strncpy( event_prefix, dbrow[index++], sizeof(event_prefix)-1 ); strncpy( event_prefix, dbrow[index++], sizeof(event_prefix)-1 );
} else {
event_prefix[0] = 0;
index++;
}
if ( dbrow[index] ) {
strncpy( label_format, dbrow[index++], sizeof(label_format)-1 ); strncpy( label_format, dbrow[index++], sizeof(label_format)-1 );
} else {
label_format[0] = 0;
index++;
}
label_coord = Coord( atoi(dbrow[index]), atoi(dbrow[index+1]) ); index += 2; label_coord = Coord( atoi(dbrow[index]), atoi(dbrow[index+1]) ); index += 2;
label_size = atoi(dbrow[index++]); label_size = atoi(dbrow[index++]);
warmup_count = atoi(dbrow[index++]); warmup_count = atoi(dbrow[index++]);