1
0
Fork 0
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:
Markus Grigull 2017-09-24 21:04:00 +02:00
parent fe2de0f524
commit 85eead776c
2 changed files with 5 additions and 2 deletions

View file

@ -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 (

View file

@ -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