From 2e03e8e9d3542d3d51cc4380e5e20d142ffbb52c Mon Sep 17 00:00:00 2001 From: Matt Dziuban Date: Tue, 12 Nov 2024 17:52:07 -0500 Subject: [PATCH] Stricter checks in `LegacyColor` constructor (#349) --- lib/src/legacy/value/color.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/legacy/value/color.ts b/lib/src/legacy/value/color.ts index b0f2d9d6..2f91de6c 100644 --- a/lib/src/legacy/value/color.ts +++ b/lib/src/legacy/value/color.ts @@ -2,6 +2,7 @@ // MIT-style license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT. +import {isNullOrUndefined} from '../../utils'; import {SassColor} from '../../value/color'; import {LegacyValueBase} from './base'; @@ -22,7 +23,7 @@ export class LegacyColor extends LegacyValueBase { } let red: number; - if (!green || !blue) { + if (isNullOrUndefined(green) || isNullOrUndefined(blue)) { const argb = redOrArgb as number; alpha = (argb >> 24) / 0xff; red = (argb >> 16) % 0x100;