summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkrasimir <krasimir@chalmers.se>2016-05-30 17:15:09 +0000
committerkrasimir <krasimir@chalmers.se>2016-05-30 17:15:09 +0000
commited1e60f6336d683a41dbe88bb406d6bff693e090 (patch)
treefd29e36bca54195b234032891600fa1c3196dd7d /src
parent3381ae1aa009fd26455639bf4affb262414ab40e (diff)
fix in the Haskell binding: functionType should throw error if the function is not defined
Diffstat (limited to 'src')
-rw-r--r--src/runtime/haskell-bind/PGF2.hsc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/runtime/haskell-bind/PGF2.hsc b/src/runtime/haskell-bind/PGF2.hsc
index 6435813ee..e7b13fbc1 100644
--- a/src/runtime/haskell-bind/PGF2.hsc
+++ b/src/runtime/haskell-bind/PGF2.hsc
@@ -149,7 +149,9 @@ functionType p fn =
withGuPool $ \tmpPl -> do
c_fn <- newUtf8CString fn tmpPl
c_type <- pgf_function_type (pgf p) c_fn
- peekType c_type
+ if c_type == nullPtr
+ then throwIO (PGFError ("Function '"++fn++"' is not defined"))
+ else peekType c_type
where
peekType c_type = do
cid <- (#peek PgfType, cid) c_type >>= peekUtf8CString