Mass: add some sanity checks.

This commit is contained in:
Guillaume Jacquemin 2021-10-02 19:23:35 +02:00
parent 19c00a3ce3
commit 6f3da0b4a7

View file

@ -147,6 +147,11 @@ void Mass::refreshValues() {
return; return;
} }
if(frame_styles->items.size() != 4) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < 4; i++) { for(UnsignedInt i = 0; i < 4; i++) {
_frame.styles[i] = frame_styles->at<IntProperty>(i)->value; _frame.styles[i] = frame_styles->at<IntProperty>(i)->value;
} }
@ -169,6 +174,11 @@ void Mass::refreshValues() {
return; return;
} }
if(frame_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) { for(UnsignedInt i = 0; i < frame_styles->items.size(); i++) {
auto style_prop = frame_styles->at<GenericStructProperty>(i); auto style_prop = frame_styles->at<GenericStructProperty>(i);
@ -205,6 +215,11 @@ void Mass::refreshValues() {
return; return;
} }
if(armour_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < armour_styles->items.size(); i++) { for(UnsignedInt i = 0; i < armour_styles->items.size(); i++) {
auto style_prop = armour_styles->at<GenericStructProperty>(i); auto style_prop = armour_styles->at<GenericStructProperty>(i);
@ -241,6 +256,11 @@ void Mass::refreshValues() {
return; return;
} }
if(global_styles->items.size() != 16) {
_state = State::Invalid;
return;
}
for(UnsignedInt i = 0; i < global_styles->items.size(); i++) { for(UnsignedInt i = 0; i < global_styles->items.size(); i++) {
auto style_prop = global_styles->at<GenericStructProperty>(i); auto style_prop = global_styles->at<GenericStructProperty>(i);