diff options
-rw-r--r-- | basic/source/runtime/runtime.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 607604f8abd6..9424482da487 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -2597,10 +2597,14 @@ void SbiRuntime::StepNEXT() StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR ); return; } - if( pForStk->eForType == ForType::To ) + if (pForStk->eForType != ForType::To) + return; + if (!pForStk->refVar) { - pForStk->refVar->Compute( SbxPLUS, *pForStk->refInc ); + StarBASIC::FatalError( ERRCODE_BASIC_INTERNAL_ERROR ); + return; } + pForStk->refVar->Compute( SbxPLUS, *pForStk->refInc ); } // beginning CASE: TOS in CASE-stack |