From d5d305193ce527f1cc3022c406de35d9a85d4ccb Mon Sep 17 00:00:00 2001 From: hrxi Date: Sun, 1 Sep 2019 18:18:25 +0200 Subject: Fix some warnings Instances of `RegexError` are just asserted as `assert_not_reached` as they cannot really fail except for allocation failure if the given regex is valid. --- main/src/ui/avatar_image.vala | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'main/src/ui/avatar_image.vala') diff --git a/main/src/ui/avatar_image.vala b/main/src/ui/avatar_image.vala index d98e5baa..cc700f00 100644 --- a/main/src/ui/avatar_image.vala +++ b/main/src/ui/avatar_image.vala @@ -1,6 +1,7 @@ using Gtk; using Dino.Entities; using Xmpp; +using Xmpp.Util; namespace Dino.Ui { @@ -74,10 +75,10 @@ public class AvatarImage : Misc { } private static void set_source_hex_color(Cairo.Context ctx, string hex_color) { - ctx.set_source_rgba((double) hex_color.substring(0, 2).to_long(null, 16) / 255, - (double) hex_color.substring(2, 2).to_long(null, 16) / 255, - (double) hex_color.substring(4, 2).to_long(null, 16) / 255, - hex_color.length > 6 ? (double) hex_color.substring(6, 2).to_long(null, 16) / 255 : 1); + ctx.set_source_rgba((double) from_hex(hex_color.substring(0, 2)) / 255, + (double) from_hex(hex_color.substring(2, 2)) / 255, + (double) from_hex(hex_color.substring(4, 2)) / 255, + hex_color.length > 6 ? (double) from_hex(hex_color.substring(6, 2)) / 255 : 1); } public override bool draw(Cairo.Context ctx_in) { -- cgit v1.2.3-54-g00ecf