Fix orphaned debug log and array bounds check
- Remove console.log('hello:') from Measurement.js (#22)
- Add bounds check for peakIndex in predict_class.js (#23)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -161,6 +161,11 @@ class Predict {
|
||||
//find index of y peak
|
||||
const { peak , peakIndex } = this.getLocalPeak(curve.y);
|
||||
|
||||
// Guard against invalid peakIndex (e.g. empty array returns -1)
|
||||
if (peakIndex < 0 || peakIndex >= curve.x.length) {
|
||||
return { yPeak: null, x: null, xProcent: null };
|
||||
}
|
||||
|
||||
// scale the x value to procentual value
|
||||
const yPeak = peak;
|
||||
const x = curve.x[peakIndex];
|
||||
|
||||
Reference in New Issue
Block a user