Skip to content

Instantly share code, notes, and snippets.

@weltling
Created November 1, 2013 22:31
Show Gist options
  • Save weltling/7273037 to your computer and use it in GitHub Desktop.
Save weltling/7273037 to your computer and use it in GitHub Desktop.
diff --git a/fann.c b/fann.c
index 9cb3171..531ad19 100644
--- a/fann.c
+++ b/fann.c
@@ -933,7 +933,9 @@ ZEND_GET_MODULE(fann)
/* macro for chencking fann_error structs */
#define PHP_FANN_ERROR_CHECK(__fann_struct) \
- if (fann_get_errno((struct fann_error *) __fann_struct) != 0) { \
+ if (NULL == __fann_struct) { \
+ RETURN_FALSE; \
+ } else if (fann_get_errno((struct fann_error *) __fann_struct) != 0) { \
php_error_docref(NULL TSRMLS_CC, E_WARNING, __fann_struct->errstr); \
RETURN_FALSE; \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment