Explorar el Código

Added conditional preprocessor NO_EXCEPTION_KEY_NOT_FOUND to sqvm.cpp to enable/disable throwing exceptions when a key is not found on tables.

mingodad hace 13 años
padre
commit
2d343adbb6
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      squirrel/sqvm.cpp

+ 5 - 0
squirrel/sqvm.cpp

@@ -801,7 +801,12 @@ exception_restore:
 				}
 				}
 				continue;
 				continue;
 			case _OP_GETK:
 			case _OP_GETK:
+#ifndef NO_EXCEPTION_KEY_NOT_FOUND
 				if (!Get(STK(arg2), ci->_literals[arg1], temp_reg, false,arg2)) { SQ_THROW();}
 				if (!Get(STK(arg2), ci->_literals[arg1], temp_reg, false,arg2)) { SQ_THROW();}
+#else
+				//DAD instead of throw an exception return null
+				if(!Get(STK(arg2), ci->_literals[arg1], temp_reg, false,arg2)) temp_reg.Null();
+#endif
 				_Swap(TARGET,temp_reg);//TARGET = temp_reg;
 				_Swap(TARGET,temp_reg);//TARGET = temp_reg;
 				continue;
 				continue;
 			case _OP_MOVE: TARGET = STK(arg1); continue;
 			case _OP_MOVE: TARGET = STK(arg1); continue;