From 8262760bc733275d9a95399e143f7f85250d4bee Mon Sep 17 00:00:00 2001 From: Sven Weidauer Date: Fri, 1 Jan 2021 15:18:16 +0100 Subject: [PATCH] Limit percent value from 0 to 100. --- Sources/LibMakeColors/Model/Scanner+ColorParser.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/LibMakeColors/Model/Scanner+ColorParser.swift b/Sources/LibMakeColors/Model/Scanner+ColorParser.swift index d114d4a..9870824 100644 --- a/Sources/LibMakeColors/Model/Scanner+ColorParser.swift +++ b/Sources/LibMakeColors/Model/Scanner+ColorParser.swift @@ -182,6 +182,7 @@ extension Scanner { } if string("%") { + guard 0...100 ~= int else { return nil } int = int * 0xFF / 100 }