git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit53d0786c206c2fb06b9df1663442bf2a6ddb2674
parentd0d3f1ebce
authorIsaac Freund <[email protected]>
date2021-07-24 10:39
river: fix crash on parsing empty string as color

 river/command/config.zig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/river/command/config.zig b/river/command/config.zig
index 0d93002..00a3494 100644
--- a/river/command/config.zig
+++ b/river/command/config.zig
@@ -96,7 +96,7 @@ pub fn setCursorWarp(
 
 /// Parse a color in the format #RRGGBB or #RRGGBBAA
 fn parseRgba(string: []const u8) ![4]f32 {
-    if (string[0] != '#' or (string.len != 7 and string.len != 9)) return error.InvalidRgba;
+    if ((string.len != 7 and string.len != 9) or string[0] != '#') return error.InvalidRgba;
 
     const r = try std.fmt.parseInt(u8, string[1..3], 16);
     const g = try std.fmt.parseInt(u8, string[3..5], 16);