Skip to content

Make sure that CYMRGB is same length as MAX_CHANNELS #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

will-moore
Copy link
Collaborator

This fixes a bug when viewing images that have no omero rendering metadata, and have more than MAX_CHANNELS.

In getDefaultColors() we have:

    // Set visible indices to CYMRGB colors. visibleIndices.length === MAX_CHANNELS from above.
    for (const [i, visibleIndex] of visibleIndices.entries()) {
      colors[visibleIndex] = CYMRGB[i];
    }

but the loop goes up to where i is MAX_CHANNELS. However, the length of CYMRGB is less than this, so when i is 6, then CYMRGB[i] is undefined.

This is fixed by slicing CYMRBG to be the same length as MAX_CHANNELS.

This avoids undefined for CYMRGB[i] in getDefaultColors() below
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant