Skip to content

Commit a8cf5d7

Browse files
committed
Fix: Null Safety
1 parent d532b13 commit a8cf5d7

1 file changed

Lines changed: 21 additions & 16 deletions

File tree

HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadPage.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -440,22 +440,27 @@ private static final class AddonItem extends StackPane {
440440

441441
SVG svg = null;
442442
String styleClass = null;
443-
switch (dataItem.versionType()) {
444-
case Alpha:
445-
content.addTag(i18n("addon.channel.alpha"));
446-
svg = SVG.ALPHA_CIRCLE;
447-
styleClass = "alpha";
448-
break;
449-
case Beta:
450-
content.addTag(i18n("addon.channel.beta"));
451-
svg = SVG.BETA_CIRCLE;
452-
styleClass = "beta";
453-
break;
454-
case Release:
455-
content.addTag(i18n("addon.channel.release"));
456-
svg = SVG.RELEASE_CIRCLE;
457-
styleClass = "release";
458-
break;
443+
if (dataItem.versionType() != null) {
444+
switch (dataItem.versionType()) {
445+
case Alpha:
446+
content.addTag(i18n("addon.channel.alpha"));
447+
svg = SVG.ALPHA_CIRCLE;
448+
styleClass = "alpha";
449+
break;
450+
case Beta:
451+
content.addTag(i18n("addon.channel.beta"));
452+
svg = SVG.BETA_CIRCLE;
453+
styleClass = "beta";
454+
break;
455+
case Release:
456+
content.addTag(i18n("addon.channel.release"));
457+
svg = SVG.RELEASE_CIRCLE;
458+
styleClass = "release";
459+
break;
460+
default:
461+
styleClass = "";
462+
break;
463+
}
459464
}
460465
if (svg != null) {
461466
SVGContainer icon = svg.createIcon(24);

0 commit comments

Comments
 (0)