summaryrefslogtreecommitdiff
path: root/src/LuaBigInt.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/LuaBigInt.cc')
-rw-r--r--src/LuaBigInt.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/LuaBigInt.cc b/src/LuaBigInt.cc
index d70cc55..b608afd 100644
--- a/src/LuaBigInt.cc
+++ b/src/LuaBigInt.cc
@@ -134,7 +134,7 @@ int sLua_BigInt::BigInt_proceed_static(Lua & L, int n, int caller) {
switch (caller) {
case BIGINT_CONSTRUCTOR:
{
- BigInt * a;
+ BigInt * a = NULL;
if (L.type() == LUA_TSTRING) {
a = new BigInt();
s = L.tostring(1);
@@ -155,9 +155,11 @@ int sLua_BigInt::BigInt_proceed_static(Lua & L, int n, int caller) {
} else {
L.error("Invalid arguments to BigInt:new");
}
- LuaBigIntFactory o(a);
- o.pushDestruct(L);
- r = 1;
+ if (a) {
+ LuaBigIntFactory o(a);
+ o.pushDestruct(L);
+ r = 1;
+ }
break;
}
}