diff options
-rw-r--r-- | src/curses.c | 3 | ||||
-rw-r--r-- | src/strings.c | 6 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/curses.c b/src/curses.c index 9fcfa09..34809f9 100644 --- a/src/curses.c +++ b/src/curses.c @@ -125,6 +125,9 @@ static int get_char_attr(lua_State* L, int stack_pos) int cur_mode; cur_mode = get_mode_enum(str); + if (cur_mode == -1) { + return luaL_error(L, "Unknown attribute %s", str); + } lua_toboolean(L, -1) ? (mode |= cur_mode) : (mode &= ~cur_mode); } diff --git a/src/strings.c b/src/strings.c index 0eca298..1a211a2 100644 --- a/src/strings.c +++ b/src/strings.c @@ -142,11 +142,7 @@ int get_color_enum(const char* str) int get_mode_enum(const char* str) { - int ret; - - ret = str2enum(modes, lengthof(modes), str); - - return ret == -1 ? A_NORMAL : ret; + return str2enum(modes, lengthof(modes), str); } int get_key_enum(const char* str) |