Skip to content

Commit 36ea075

Browse files
AmirMohammad CheraghaliAmirMohammad Cheraghali
authored andcommitted
Fix: Add safety check for scale array in coloring
1 parent b93fb08 commit 36ea075

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/components/ProteinViewer.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2579,9 +2579,11 @@ export const ProteinViewer = forwardRef<ProteinViewerRef, ProteinViewerProps>(({
25792579
// Fix: High Contrast for Chains
25802580
// If coloring by chain, ignore the global aesthetic palette (often monotonic like Magma)
25812581
// and force a high-contrast Rainbow (Spectral) to ensure distinct chain colors.
2582+
// If coloring by chain, ignore the global aesthetic palette (often monotonic like Magma)
2583+
// and force a high-contrast Rainbow (Spectral) to ensure distinct chain colors.
25822584
if (finalColor === 'chainindex') {
25832585
params.colorScale = 'Spectral';
2584-
} else if (scale && scale.length > 0) {
2586+
} else if (scale && Array.isArray(scale) && scale.length > 0) {
25852587
params.colorScale = scale;
25862588
}
25872589

0 commit comments

Comments
 (0)