Fix getThreadLocalVar() on Win32 - thanks for Krasimir for finding the bug.
{
void *r;
r = TlsGetValue(*key);
{
void *r;
r = TlsGetValue(*key);
+#ifdef DEBUG
+ // r is allowed to be NULL - it can mean that either there was an
+ // error or the stored value is in fact NULL.
+ if (GetLastError() != NO_ERROR) {
barf("getThreadLocalVar: key not found");
}
barf("getThreadLocalVar: key not found");
}