Skip to content

NullPointerException on Linux if XDG_CURRENT_DESKTOP is not defined #54

Open

Description

@lukajin

Depending on a Linux system setup, the XDG_CURRENT_DESKTOP environment variable may not be defined. However, this library expects it to be present, using the returned value without checking for null, which results in throwing NullPointerException, which the calling code may not expect and crash with an error like this:

(...)
Caused by: java.lang.NullPointerException: Cannot invoke "String.toLowerCase()" because the return value of "com.jthemedetecor.util.OsInfo.getCurrentLinuxDesktopEnvironmentName()" is null
        at launcher//com.jthemedetecor.util.OsInfo.isGnome(OsInfo.java:52)
        at launcher//com.jthemedetecor.OsThemeDetector.createDetector(OsThemeDetector.java:62)
        at launcher//com.jthemedetecor.OsThemeDetector.getDetector(OsThemeDetector.java:50)
(...)

I think EmptyDetector should be used here, like it is in other unsupported environments.

Activity

  1. WasabiThumb commented on Sep 2, 2026

    @WasabiThumb

    Slyly noting that JDaybreak inherently does not have this issue as its detection mechanism doesn't use XDG_CURRENT_DESKTOP at all, feel free to give it a spin in the meantime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions