There is no need to call setstyle if there is no style to be set. Fixes
spurious warnings about unreadable style files.
---
 surf.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/surf.c b/surf.c
index 010e5e2..2192025 100644
--- a/surf.c
+++ b/surf.c
@@ -862,8 +862,11 @@ setparameter(Client *c, int refresh, ParamName p, const 
Arg *a)
        case Style:
                webkit_user_content_manager_remove_all_style_sheets(
                    webkit_web_view_get_user_content_manager(c->view));
-               if (a->i)
-                       setstyle(c, getstyle(geturi(c)));
+               if (a->i) {
+                       const char *file = getstyle(geturi(c));
+                       if (file)
+                               setstyle(c, file);
+               }
                refresh = 0;
                break;
        case WebGL:
@@ -936,7 +939,7 @@ getstyle(const char *uri)
                        return styles[i].file;
        }
 
-       return "";
+       return NULL;
 }
 
 void
-- 
2.35.1


Reply via email to