aboutsummaryrefslogtreecommitdiff
path: root/system/lib
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-20 18:39:45 -0700
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:26:30 +0300
commit0a6f5476f19792164e122c27ffca83baa69c1ca3 (patch)
tree25131d3227b4bdf2c2b58e2a7ce4f9775f35423f /system/lib
parent4d6377d15e3ba48f4a6d5eb311bbd8afb618cf0d (diff)
If calling function that uses unbound types, give a sensible error message.
Diffstat (limited to 'system/lib')
-rwxr-xr-xsystem/lib/embind/bind.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/system/lib/embind/bind.cpp b/system/lib/embind/bind.cpp
index 04a30dfc..a75ba96a 100755
--- a/system/lib/embind/bind.cpp
+++ b/system/lib/embind/bind.cpp
@@ -12,6 +12,12 @@ static std::string _embind_getTypeName(intptr_t ti_raw) {
auto ti = reinterpret_cast<const std::type_info*>(ti_raw);
int stat;
char* demangled = abi::__cxa_demangle(ti->name(), NULL, NULL, &stat);
+ if (stat == 0) {
+ std::string rv(demangled);
+ free(demangled);
+ return rv;
+ }
+
switch (stat) {
case -1:
return "<allocation failure>";
@@ -19,11 +25,9 @@ static std::string _embind_getTypeName(intptr_t ti_raw) {
return "<invalid C++ symbol>";
case -3:
return "<invalid argument>";
+ default:
+ return "<unknown error>";
}
-
- std::string rv(demangled);
- free(demangled);
- return rv;
}
namespace emscripten {