summaryrefslogtreecommitdiff
path: root/python/generator.cpp
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-06-12 21:59:50 -0400
committerAlexander Taylor <alex@vector35.com>2024-06-26 09:47:42 -0400
commit015bb4fa79d01a1e2d4887cba96d150c7e1dd3bb (patch)
tree8333733fca03ec373b63d7390096db986e0b8a3f /python/generator.cpp
parent17435e0df2dccb8f09ec26e54de017ee05ade8ee (diff)
[Enterprise] Clean up initialization flow
Diffstat (limited to 'python/generator.cpp')
-rw-r--r--python/generator.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/python/generator.cpp b/python/generator.cpp
index 3fdf1fc1..c40d8d08 100644
--- a/python/generator.cpp
+++ b/python/generator.cpp
@@ -567,7 +567,10 @@ int main(int argc, char* argv[])
// Emit wrapper to get Python string and free native memory
fprintf(out, "\tresult = ");
fprintf(out, "%s\n", stringArgFuncCall.c_str());
- fprintf(out, "\tstring = str(pyNativeStr(ctypes.cast(result, ctypes.c_char_p).value))\n");
+ fprintf(out, "\tcasted = ctypes.cast(result, ctypes.c_char_p).value\n");
+ fprintf(out, "\tif casted is None:\n");
+ fprintf(out, "\t\treturn None\n");
+ fprintf(out, "\tstring = str(pyNativeStr(casted))\n");
fprintf(out, "\tBNFreeString(result)\n");
fprintf(out, "\treturn string\n");
}