]> jfr.im git - irc/quakenet/newserv.git/blobdiff - newsearch/ns-not.c
LUA: port luadb to dbapi2 to drop postgres dependency
[irc/quakenet/newserv.git] / newsearch / ns-not.c
index b0be880c65d46ae414ea5edfa4df039aa5e4326a..0e8f97a7733d28cc5b5e4eab20069ece25fcda86 100644 (file)
@@ -10,7 +10,7 @@
 void not_free(searchCtx *ctx, struct searchNode *thenode);
 void *not_exe(searchCtx *ctx, struct searchNode *thenode, void *theinput);
 
-struct searchNode *not_parse(searchCtx *ctx, int type, int argc, char **argv) {
+struct searchNode *not_parse(searchCtx *ctx, int argc, char **argv) {
   searchNode *thenode, *subnode;
 
   if (argc!=1) {
@@ -28,7 +28,7 @@ struct searchNode *not_parse(searchCtx *ctx, int type, int argc, char **argv) {
   thenode->exe          = not_exe;
   thenode->free         = not_free;
 
-  subnode=ctx->parser(ctx, type, argv[0]); /* Propogate the search type */
+  subnode=ctx->parser(ctx, argv[0]); /* Propogate the search type */
 
   if (!subnode) {
     free(thenode);
@@ -37,7 +37,11 @@ struct searchNode *not_parse(searchCtx *ctx, int type, int argc, char **argv) {
 
   /* Our subnode needs to return a BOOL */  
   subnode=coerceNode(ctx, subnode, RETURNTYPE_BOOL);
-
+  if(!subnode) {
+    free(thenode);
+    return NULL;
+  }
+  
   thenode->localdata=(void *)subnode;
       
   return thenode;