- // during destruction tls calls may return NULL, thus return NULL
- // immediately
- if ( GetCacheBegin() == NULL )
+ Cache::Element * const cacheBegin = GetCacheBegin();
+#ifndef wxHAS_COMPILER_TLS
+ // during destruction tls calls may return NULL, in this case return NULL
+ // immediately without accessing anything else
+ if ( cacheBegin == NULL )