From aacf4fe9a17a10c932a9b3635f36e5e73cfd32e4 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 19 Jun 2013 22:18:45 +0100 Subject: Check return value of jq_init --- jq.pyx | 7 ++++--- 1 file 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) -- cgit v1.2.3