From 032526340a02a3e5e167ee14b398aa0d9e70cb52 Mon Sep 17 00:00:00 2001
From: Randy Heit <rheit@zdoom.fake>
Date: Wed, 10 May 2006 04:12:43 +0000
Subject: [PATCH] - Redid ClearLcoks() fix that I accidentally removed.

SVN r102 (trunk)
---
 docs/rh-log.txt         | 1 +
 src/g_shared/a_keys.cpp | 6 +++++-
 src/thingdef.cpp        | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/docs/rh-log.txt b/docs/rh-log.txt
index b7f18f601..e8ec8559f 100644
--- a/docs/rh-log.txt
+++ b/docs/rh-log.txt
@@ -1,4 +1,5 @@
 May 9, 2006
+- Redid ClearLcoks() fix that I accidentally removed.
 - Added a new setting for am_rotate: 2 will enable rotation only for the
   overlay map while leaving the regular map unrotated.
 - Added a new setting for am_overlay: 2 will disable the normal automap and
diff --git a/src/g_shared/a_keys.cpp b/src/g_shared/a_keys.cpp
index 6eaf654c9..a121e2110 100644
--- a/src/g_shared/a_keys.cpp
+++ b/src/g_shared/a_keys.cpp
@@ -322,7 +322,11 @@ static void ClearLocks()
 	{
 		if (PClass::m_Types[i]->IsDescendantOf(RUNTIME_CLASS(AKey)))
 		{
-			static_cast<AKey*>(GetDefaultByType(PClass::m_Types[i]))->KeyNumber=0;
+			AKey *key = static_cast<AKey*>(GetDefaultByType(PClass::m_Types[i]));
+			if (key != NULL)
+			{
+				key->KeyNumber = 0;
+			}
 		}
 	}
 	for(i=0;i<256;i++)
diff --git a/src/thingdef.cpp b/src/thingdef.cpp
index 670c72c55..4ba76ac08 100644
--- a/src/thingdef.cpp
+++ b/src/thingdef.cpp
@@ -2180,7 +2180,7 @@ void ProcessActor(void (*process)(FState *, int))
 	catch (...)
 	{
 		if (info)
-			SC_ScriptError("Unexpected error during parsing of actor %s", info->Class->Name+1);
+			SC_ScriptError("Unexpected error during parsing of actor %s", info->Class->TypeName.GetChars());
 		else
 			SC_ScriptError("Unexpected error during parsing of actor definitions");
 	}