summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@gmail.com>2010-12-28 20:26:08 -0800
committerTom Stellard <tstellar@gmail.com>2010-12-28 20:26:08 -0800
commit4f4f616a00c84867872e95720d4b5b0623062310 (patch)
tree239a984f77317057e8ec03e31d619685b07778fd
parent8d529bed1a43007db8f083c69d270c67ccb40773 (diff)
Return null if constant index is outside of bounds
-rw-r--r--emulator.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/emulator.cpp b/emulator.cpp
index 92a615c..c793ddf 100644
--- a/emulator.cpp
+++ b/emulator.cpp
@@ -68,6 +68,9 @@ emulator::get_value(register_address addr)
break;
case REGISTER_TYPE_CONST:
{
+ if (index >= m_const_regs.size()) {
+ return NULL;
+ }
float_value * val = m_const_regs[index];
if (val->m_has_value) {