Skip to content

Commit eb8a0c4

Browse files
committed
fix: improve null safety for anchor point color retrieval
1 parent 967674c commit eb8a0c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

dist/index.mjs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,7 @@ var Poline = class {
517517
* getColorAt(1) // Returns color at the very end
518518
*/
519519
getColorAt(t) {
520+
var _a;
520521
if (t < 0 || t > 1) {
521522
throw new Error("Position must be between 0 and 1");
522523
}
@@ -533,7 +534,7 @@ var Poline = class {
533534
const pair = this._anchorPairs[actualSegmentIndex];
534535
if (!pair || pair.length < 2 || !pair[0] || !pair[1]) {
535536
return new ColorPoint({
536-
color: this.anchorPoints[0]?.color || [0, 0, 0],
537+
color: ((_a = this.anchorPoints[0]) == null ? void 0 : _a.color) || [0, 0, 0],
537538
invertedLightness: this._invertedLightness
538539
});
539540
}
@@ -584,3 +585,4 @@ export {
584585
randomHSLPair,
585586
randomHSLTriple
586587
};
588+
//# sourceMappingURL=index.mjs.map

0 commit comments

Comments
 (0)