diff --git a/statusbar.c b/statusbar.c index 73c979ea..e8cc3b8e 100644 --- a/statusbar.c +++ b/statusbar.c @@ -368,9 +368,8 @@ luaA_statusbar_widget_add(lua_State *L) /* check that there is not already a widget with that name in the titlebar */ for(witer = (*sb)->widgets; witer; witer = witer->next) - if(witer->widget == *widget) - luaL_error(L, "widget `%s' is already on statusbar"); - else if(!a_strcmp(witer->widget->name, (*widget)->name)) + if(witer->widget != *widget + && !a_strcmp(witer->widget->name, (*widget)->name)) luaL_error(L, "a widget with name `%s' already on statusbar `%s'", witer->widget->name, (*sb)->name); diff --git a/titlebar.c b/titlebar.c index 06e83951..f7fd49b9 100644 --- a/titlebar.c +++ b/titlebar.c @@ -354,9 +354,8 @@ luaA_titlebar_widget_add(lua_State *L) /* check that there is not already a widget with that name in the titlebar */ for(witer = (*tb)->widgets; witer; witer = witer->next) - if(witer->widget == *widget) - luaL_error(L, "widget `%s' is already on titlebar"); - else if(!a_strcmp(witer->widget->name, (*widget)->name)) + if(witer->widget != *widget + && !a_strcmp(witer->widget->name, (*widget)->name)) luaL_error(L, "a widget with name `%s' already on titlebar", witer->widget->name); w->widget = *widget;