criteria: allow matching for NULL string criteria

This commit is contained in:
Callum Andrew 2022-11-04 12:31:00 +11:00 committed by Simon Ser
parent e40eb338b9
commit 3e19836f0e

View file

@ -210,7 +210,7 @@ static bool criteria_matches_view(struct criteria *criteria,
if (criteria->shell) { if (criteria->shell) {
const char *shell = view_get_shell(view); const char *shell = view_get_shell(view);
if (!shell) { if (!shell) {
return false; shell = "";
} }
switch (criteria->shell->match_type) { switch (criteria->shell->match_type) {
@ -230,7 +230,7 @@ static bool criteria_matches_view(struct criteria *criteria,
if (criteria->app_id) { if (criteria->app_id) {
const char *app_id = view_get_app_id(view); const char *app_id = view_get_app_id(view);
if (!app_id) { if (!app_id) {
return false; app_id = "";
} }
switch (criteria->app_id->match_type) { switch (criteria->app_id->match_type) {
@ -262,7 +262,7 @@ static bool criteria_matches_view(struct criteria *criteria,
if (criteria->class) { if (criteria->class) {
const char *class = view_get_class(view); const char *class = view_get_class(view);
if (!class) { if (!class) {
return false; class = "";
} }
switch (criteria->class->match_type) { switch (criteria->class->match_type) {
@ -282,7 +282,7 @@ static bool criteria_matches_view(struct criteria *criteria,
if (criteria->instance) { if (criteria->instance) {
const char *instance = view_get_instance(view); const char *instance = view_get_instance(view);
if (!instance) { if (!instance) {
return false; instance = "";
} }
switch (criteria->instance->match_type) { switch (criteria->instance->match_type) {
@ -302,7 +302,7 @@ static bool criteria_matches_view(struct criteria *criteria,
if (criteria->window_role) { if (criteria->window_role) {
const char *window_role = view_get_window_role(view); const char *window_role = view_get_window_role(view);
if (!window_role) { if (!window_role) {
return false; window_role = "";
} }
switch (criteria->window_role->match_type) { switch (criteria->window_role->match_type) {