}
struct blerg *b = blerg_open(username);
- blerg_close(b);
- auth_set_password(username, password);
-
- respond_JSON_Success();
+ if (b != NULL) {
+ blerg_close(b);
+ auth_set_password(username, password);
+
+ respond_JSON_Success();
+ } else {
+ respond_JSON_Failure();
+ }
} else if (strncmp(path, "/login", 7) == 0) {
if (strcmp(request_method, "POST") != 0) {
respond_405();