Fix number comparisons for position values

This commit is contained in:
2025-10-03 15:55:20 +02:00
parent c70bed2b39
commit 5117df14db
2 changed files with 49 additions and 49 deletions

View File

@@ -40,7 +40,7 @@ class MeasurementBuilder {
if (!this.variant) { if (!this.variant) {
throw new Error('Measurement variant is required'); throw new Error('Measurement variant is required');
} }
if (!this.position) { if (Number.isNaN(this.position)) {
throw new Error('Measurement position is required'); throw new Error('Measurement position is required');
} }

View File

@@ -284,7 +284,7 @@ class MeasurementContainer {
// Helper methods // Helper methods
_ensureChainIsValid() { _ensureChainIsValid() {
if (!this._currentType || !this._currentVariant || !this._currentPosition) { if (!this._currentType || !this._currentVariant || Number.isNaN(this._currentPosition)) {
if (this.logger) { if (this.logger) {
this.logger.error('Incomplete measurement chain, required: type, variant, and position'); this.logger.error('Incomplete measurement chain, required: type, variant, and position');
} }