diff --git a/src/js/axis-vars.js b/src/js/axis-vars.js index cafd7c5..7e47e1e 100644 --- a/src/js/axis-vars.js +++ b/src/js/axis-vars.js @@ -56,7 +56,12 @@ module.exports = { const abs = this.state[`${axis}p`] || 0; const off = this.state[`offset_${axis}`]; const motor_id = this._get_motor_id(axis); - const motor = motor_id == -1 ? {} : this.config.motors[motor_id]; + // motor_id may be 4 for the synthetic external-axis motor; + // there is no entry for it in config.motors so guard with + // an empty object to avoid undefined property access. + const motor = (motor_id == -1 + ? {} + : (this.config.motors[motor_id] || {})); const enabled = this._check_is_enabled(axis); const homingMode = motor["homing-mode"]; const homed = this.state[`${motor_id}homed`];