axis-vars: guard motor lookup for synthetic motor 4
_compute_axis indexed config.motors[motor_id] directly without
checking the array length. For motor_id=4 (the synthetic external-
axis motor used by ExternalAxis) there is no entry in config.motors,
so motor was undefined and motor["homing-mode"] threw - which
made the entire 'a' computed prop return undefined and the A row
never rendered.
Default to {} when the index is out of bounds.
This commit is contained in:
@@ -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`];
|
||||
|
||||
Reference in New Issue
Block a user