Skip to content

[JEWEL-803] Replace get() with safer getOrNull() in ThemeColorPalette #3015

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: master
Choose a base branch
from

Conversation

hamen
Copy link
Collaborator

@hamen hamen commented Apr 2, 2025

This PR addresses an unfortunate lack of warning for methods that can throw exceptions.

ThemeColorPalette was using a nullable chain containing also get(index) and then acting on missing values using the Elvis operator .?. Unfortunately, get(index) is an unsafe method that throws, preventing the .? from doing any rescue.

We switched to a safer variant, and properly managing the null.

@hamen hamen self-assigned this Apr 2, 2025
@hamen hamen requested a review from rock3r April 2, 2025 10:49
@rock3r rock3r added the Jewel label Apr 2, 2025
@hamen hamen force-pushed the hamen/JEWEL-803 branch 2 times, most recently from fee1820 to 5e9a18a Compare April 2, 2025 11:21
@hamen hamen force-pushed the hamen/JEWEL-803 branch from 5e9a18a to 86d61e4 Compare April 2, 2025 13:02
@hamen hamen requested a review from rock3r April 2, 2025 13:06
@hamen hamen force-pushed the hamen/JEWEL-803 branch from 86d61e4 to 87dbc70 Compare April 3, 2025 09:00
Copy link
Collaborator

@rock3r rock3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ready to merge

@hamen hamen force-pushed the hamen/JEWEL-803 branch from 87dbc70 to 19e5f0c Compare April 14, 2025 13:19
@hamen
Copy link
Collaborator Author

hamen commented Apr 14, 2025

  • Rebased
  • Ran IDEA
  • Ran Standalone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants