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

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


The following commit(s) were added to refs/heads/main by this push:
     new 9e34c6cb Fix the different themes (#835)
9e34c6cb is described below

commit 9e34c6cb670686a2ae59d2c3cd6459c025950238
Author: Bertil Chapuis <[email protected]>
AuthorDate: Fri Feb 23 22:01:43 2024 +0100

    Fix the different themes (#835)
---
 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