--- cmCommandArgumentParserHelper.cxx.orig	2009-10-09 16:12:36.000000000 -0500
+++ cmCommandArgumentParserHelper.cxx	2009-10-21 23:10:38.000000000 -0500
@@ -66,6 +66,15 @@
     {
     return this->ExpandVariable(var);
     } 
+  
+  if ( !var )
+    {
+    cmOStringStream e;
+    e << "Syntax $" << key << "{} is not supported.";
+    this->SetError(e.str());
+    return 0;
+    }
+
   if ( strcmp(key, "ENV") == 0 )
     {
     char *ptr = getenv(var);
@@ -82,7 +91,7 @@
       }
     return this->EmptyVariable;
     }
-  if ( strcmp(key, "CACHE") == 0 )
+  else if ( strcmp(key, "CACHE") == 0 )
     {
     if(const char* c = this->Makefile->GetCacheManager()->GetCacheValue(var))
       {
@@ -98,8 +107,8 @@
     return this->EmptyVariable;
     }
   cmOStringStream e;
-  e << "Syntax $" << key << "{} is not supported.  "
-    << "Only ${}, $ENV{}, and $CACHE{} are allowed.";
+  e << "Syntax $" << key << "{var} is not supported.  "
+    << "Only ${var}, $ENV{var}, and $CACHE{var} are allowed.";
   this->SetError(e.str());
   return 0;
 }
