Commit 65f1a900 authored by Victor Yacovlev's avatar Victor Yacovlev

Fixed runtime error on partial array initialization

parent d3f8bed7
...@@ -565,6 +565,7 @@ void Variable::setConstValue(const Variable & ctab) ...@@ -565,6 +565,7 @@ void Variable::setConstValue(const Variable & ctab)
for (int y=0; y<=sy; y++) { for (int y=0; y<=sy; y++) {
for (int x=0; x<=sx; x++) { for (int x=0; x<=sx; x++) {
setValue(my+y, mx+x, ctab.value(cy+y, cx+x)); setValue(my+y, mx+x, ctab.value(cy+y, cx+x));
unsetError();
} }
} }
break; break;
......
...@@ -2116,7 +2116,11 @@ void KumirVM::do_load(uint8_t s, uint16_t id) ...@@ -2116,7 +2116,11 @@ void KumirVM::do_load(uint8_t s, uint16_t id)
val.setDimension(moduleContexts[stack_contexts.top().moduleContextNo].constants[id].dimension()); val.setDimension(moduleContexts[stack_contexts.top().moduleContextNo].constants[id].dimension());
moduleContexts[stack_contexts.top().moduleContextNo].constants[id].getBounds(bounds); moduleContexts[stack_contexts.top().moduleContextNo].constants[id].getBounds(bounds);
val.setBounds(bounds); val.setBounds(bounds);
val.setValue(moduleContexts[stack_contexts.top().moduleContextNo].constants[id].value()); bool wasError = Kumir::Core::getError().length()>0;
AnyValue v = moduleContexts[stack_contexts.top().moduleContextNo].constants[id].value();
if (!wasError)
Variable::unsetError();
val.setValue(v);
val.setConstantFlag(true); val.setConstantFlag(true);
} }
else { else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment