This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch fix-light-theme
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git

commit 5b8db5ee106da7868c49005bf0be64f5608fff5f
Author: Bertil Chapuis <[email protected]>
AuthorDate: Fri Feb 23 22:00:27 2024 +0100

    Fix the different themes
---
 basemap/utils/color.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/basemap/utils/color.js b/basemap/utils/color.js
index 15aa2335..db21b31b 100644
--- a/basemap/utils/color.js
+++ b/basemap/utils/color.js
@@ -135,6 +135,9 @@ class RGB extends Color {
     }
 
     static fromString(color) {
+        if (typeof color !== 'string') {
+            return null;
+        }
         let rgb = color.replace(/\s*/g, '').match(/rgb\((\d*)\,(\d*)\,(\d*)\)/)
         if (rgb != null) {
             return new RGB(parseInt(rgb[1]), parseInt(rgb[2]), 
parseInt(rgb[3]), 1)
@@ -198,6 +201,9 @@ class HSL extends Color {
     }
 
     static fromString(color) {
+        if (typeof color !== 'string') {
+            return null;
+        }
         let hsl = color.replace(/\s*/g, '').match(/hsl\((\d*)\,(\d*)\,(\d*)\)/)
         if (hsl != null) {
             return new HSL(parseInt(hsl[1]), parseInt(hsl[2]), 
parseInt(hsl[3]), 1)

Reply via email to