From 878f1bf5a11659a003cd873bd2314e5cb6c9e39e Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Thu, 18 Jun 2020 05:19:12 -0400 Subject: [PATCH] Fix parameter-less macros --- assembler/directives.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assembler/directives.c b/assembler/directives.c index 78047ec..f92260c 100644 --- a/assembler/directives.c +++ b/assembler/directives.c @@ -1151,12 +1151,12 @@ int handle_macro(struct assembler_state *state, char **argv, int argc) { } char *location = strchr(argv[0], '('); - if (location == NULL || location == argv[0]) { + if (location == argv[0]) { ERROR(ERROR_INVALID_DIRECTIVE, state->column, "macro without a name"); return 1; } - if (strchr(location + 1, '(') != NULL) { + if (location && strchr(location + 1, '(') != NULL) { ERROR(ERROR_INVALID_DIRECTIVE, state->column, "macro contains excess parentheses"); return 1; }