Remove another potential crash if buggy user input

This commit is contained in:
Holger Vogt 2023-12-08 10:40:33 +01:00
parent c69018fe82
commit 732c12c93f
1 changed files with 5 additions and 2 deletions

View File

@ -691,7 +691,10 @@ measure_at(
value = d->v_realdata[i];
// fprintf(cp_err, "Warning: 'meas ac' input vector is real!\n");
}
svalue = dScale->v_compdata[i].cx_real;
if (dScale->v_compdata)
svalue = dScale->v_compdata[i].cx_real;
else
svalue = dScale->v_realdata[i]; //prevent crash in case if buggy input
} else if (sp_check) {
if (d->v_compdata)
value = get_value(meas, d, i); //d->v_compdata[i].cx_real;
@ -804,7 +807,7 @@ measure_minMaxAvg(
}
if (dScale->v_realdata == NULL && dScale->v_compdata == NULL) {
fprintf(cp_err, "Error: scale vector time, frequency or v-sweep has no data.\n");
fprintf(cp_err, "Error: scale vector time, frequency or ?-sweep has no data.\n");
return MEASUREMENT_FAILURE;
}