Don't segfault if t_enum::get_constant_by_name fails

The recent enum change was causing t_enum::get_constant_by_name to fail
in t_const_value::get_integer.  This was causing a difficult-to-debug
segfault.  Check for failure and throw an exeception.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@996609 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_const_value.h b/compiler/cpp/src/parse/t_const_value.h
index 5bfaeb2..b66372b 100644
--- a/compiler/cpp/src/parse/t_const_value.h
+++ b/compiler/cpp/src/parse/t_const_value.h
@@ -72,6 +72,11 @@
         throw "have identifier \"" + get_identifier() + "\", but unset enum on line!";
       }
       t_enum_value* val = enum_->get_constant_by_name(get_identifier());
+      if (val == NULL) {
+        throw
+          "Unable to find enum value \"" + get_identifier() +
+          "\" in enum \"" + enum_->get_name() + "\"";
+      }
       return val->get_value();
     } else {
       return intVal_;