From f3ef0ec55c2203d8be50f8409752589afb6af942 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Wed, 22 Jun 2005 19:41:36 +0000 Subject: [PATCH] Fix some weird crashes. not real fix. more a workaround to prevent the crash(1201519) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2222 --- src/cpu/core_dyn_x86/cache.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/cpu/core_dyn_x86/cache.h b/src/cpu/core_dyn_x86/cache.h index 348021d1..9bdccb18 100644 --- a/src/cpu/core_dyn_x86/cache.h +++ b/src/cpu/core_dyn_x86/cache.h @@ -235,10 +235,13 @@ void CacheBlock::Clear(void) { } if (link[ind].to!=&link_blocks[ind]) { CacheBlock * * wherelink=&link[ind].to->link[ind].from; - while (*wherelink!=this) { - wherelink=&(*wherelink)->link[ind].next; + while (*wherelink != this && *wherelink) { + wherelink = &(*wherelink)->link[ind].next; } - *wherelink=(*wherelink)->link[ind].next; + if(*wherelink) + *wherelink = (*wherelink)->link[ind].next; + else + LOG(LOG_CPU,LOG_ERROR)("Cache anomaly. please investigate"); } } else cache_addunsedblock(this);