diff --git a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp index 58e478ace2..da83cf8d16 100644 --- a/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp +++ b/src/apps/debugger/debug_info/DwarfImageDebugInfo.cpp @@ -1097,14 +1097,15 @@ DwarfImageDebugInfo::_CreateReturnValues(ReturnValueInfoList* returnValueInfos, Image* image, StackFrame* frame, DwarfStackFrameDebugInfo& factory) { for (int32 i = 0; i < returnValueInfos->CountItems(); i++) { + Image* targetImage = image; ReturnValueInfo* valueInfo = returnValueInfos->ItemAt(i); target_addr_t subroutineAddress = valueInfo->SubroutineAddress(); CpuState* subroutineState = valueInfo->State(); - if (!image->ContainsAddress(subroutineAddress)) { + if (!targetImage->ContainsAddress(subroutineAddress)) { // our current image doesn't contain the target function, // locate the one which does. - image = image->GetTeam()->ImageByAddress(subroutineAddress); - if (image == NULL) { + targetImage = image->GetTeam()->ImageByAddress(subroutineAddress); + if (targetImage == NULL) { // nothing we can do, try the next entry (if any) continue; }