[nexuiz-commits] r7951 - trunk/data/qcsrc/common

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Sep 27 09:32:31 EDT 2009


Author: blub0
Date: 2009-09-27 09:32:30 -0400 (Sun, 27 Sep 2009)
New Revision: 7951

Modified:
   trunk/data/qcsrc/common/gamecommand.qc
Log:
don't let the rpn try to set a cvar when there's no name for it - prevent 'bad string' QC crash

Modified: trunk/data/qcsrc/common/gamecommand.qc
===================================================================
--- trunk/data/qcsrc/common/gamecommand.qc	2009-09-27 11:05:09 UTC (rev 7950)
+++ trunk/data/qcsrc/common/gamecommand.qc	2009-09-27 13:32:30 UTC (rev 7951)
@@ -374,13 +374,19 @@
 				} else if(rpncmd == "def" || rpncmd == "=") {
 					s = rpn_pop();
 					s2 = rpn_pop();
+
+					if(s2 != "")
+					{
 #ifdef MENUQC
-					registercvar(s2, "", 0);
+						registercvar(s2, "", 0);
 #else
-					registercvar(s2, "");
+						registercvar(s2, "");
 #endif
-					if(!rpn_error) // don't change cvars if a stack error had happened!
-						cvar_set(s2, s);
+						if(!rpn_error) // don't change cvars if a stack error had happened!
+							cvar_set(s2, s);
+					}
+					else
+						rpn_error = TRUE;
 				} else if(rpncmd == "defs" || rpncmd == "@") {
 					s = "";
 					i = rpn_popf();
@@ -391,13 +397,18 @@
 						--i;
 					}
 					s2 = rpn_pop();
+					if(s2 != "")
+					{
 #ifdef MENUQC
-					registercvar(s2, "", 0);
+						registercvar(s2, "", 0);
 #else
-					registercvar(s2, "");
+						registercvar(s2, "");
 #endif
-					if(!rpn_error) // don't change cvars if a stack error had happened!
-						cvar_set(s2, s);
+						if(!rpn_error) // don't change cvars if a stack error had happened!
+							cvar_set(s2, s);
+					}
+					else
+						rpn_error = TRUE;
 				} else if(rpncmd == "load") {
 					rpn_set(cvar_string(rpn_get()));
 				} else if(rpncmd == "exch") {



More information about the nexuiz-commits mailing list