commit:88ab89dbd281efef8258861f76810ccc2b29ac39
author:Chip Black
committer:Chip Black
date:Mon Jun 30 23:04:15 2014 -0500
parents:5e89558c1afec270c54f4827380817e3ef8591f4
Check for null clear argument
diff --git a/cgi/cgi_blerg.c b/cgi/cgi_blerg.c
line changes: +6/-7
index 8bd5189..2b7998b
--- a/cgi/cgi_blerg.c
+++ b/cgi/cgi_blerg.c
@@ -404,14 +404,13 @@ int main(int argc, char *argv[]) {
 		if (path[7] == 0) {  /* No username */
 			const char *clear = cgi_getentrystr("clear");
 
-			if (strncmp(clear, "feed", 4) == 0) {
+			if (clear != NULL) {
 				struct blerg *b = blerg_open(username);
-				blerg_set_subscription_mark(b);
-				blerg_close(b);
-				respond_JSON_Success();
-			} else if (strncmp(clear, "mentioned", 9) == 0) {
-				struct blerg *b = blerg_open(username);
-				blerg_set_status(b, BLERGSTATUS_MENTIONED, 0);
+				if (strncmp(clear, "feed", 4) == 0) {
+					blerg_set_subscription_mark(b);
+				} else if (strncmp(clear, "mentioned", 9) == 0) {
+					blerg_set_status(b, BLERGSTATUS_MENTIONED, 0);
+				}
 				blerg_close(b);
 				respond_JSON_Success();
 			} else {