mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
Fix mapping out of bound errors
This commit is contained in:
parent
fe2de0f524
commit
85eead776c
2 changed files with 5 additions and 2 deletions
|
@ -180,7 +180,7 @@ class WidgetGauge extends Component {
|
|||
|
||||
if (this.props.simulation) {
|
||||
const simulationModel = this.props.simulation.models.filter((model) => model.simulator.node === this.props.widget.simulator.node && model.simulator.simulator === this.props.widget.simulator.simulator)[0];
|
||||
signalType = (simulationModel != null && simulationModel.length > 0) ? simulationModel.mapping[this.props.widget.signal].type : '';
|
||||
signalType = (simulationModel != null && simulationModel.length > 0 && this.props.widget.signal < simulationModel.length) ? simulationModel.mapping[this.props.widget.signal].type : '';
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -46,7 +46,10 @@ class WidgetValue extends Component {
|
|||
|
||||
if (nextProps.simulation) {
|
||||
const simulationModel = nextProps.simulation.models.find(model => model.simulator.node === node && model.simulator.simulator === simulator);
|
||||
unit = simulationModel.mapping[nextProps.widget.signal].type;
|
||||
|
||||
if (nextProps.widget.signal < simulationModel.mapping.length) {
|
||||
unit = simulationModel.mapping[nextProps.widget.signal].type;
|
||||
}
|
||||
}
|
||||
|
||||
// check if value has changed
|
||||
|
|
Loading…
Add table
Reference in a new issue