summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2013-06-19 22:18:45 +0100
committerMichael Williamson <mike@zwobble.org>2013-06-19 22:18:45 +0100
commitaacf4fe9a17a10c932a9b3635f36e5e73cfd32e4 (patch)
treeef4e33b0df9ac24e0be605a1a22365ae46b7d047
parentdf5c16e23fdd70288b62026ba87fdb0af535ab6a (diff)
Check return value of jq_init
-rw-r--r--jq.pyx7
1 files changed, 4 insertions, 3 deletions
diff --git a/jq.pyx b/jq.pyx
index 2c17d1b..f5de457 100644
--- a/jq.pyx
+++ b/jq.pyx
@@ -32,9 +32,10 @@ cdef extern from "jv_parse.h":
def jq(char* program):
- cdef jq_state *jq
- # TODO: error if !jq
- jq = jq_init()
+ cdef jq_state *jq = jq_init()
+ if not jq:
+ raise Exception("jq_init failed")
+
# TODO: jq_compile prints error to stderr
cdef int compiled = jq_compile(jq, program)