Skip to content

Commit dba97fe

Browse files
committed
Fix NPE in switch case
1 parent bf02009 commit dba97fe

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

team/bundles/org.eclipse.core.net/src/org/eclipse/core/internal/net/ProxyManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ public class ProxyManager implements IProxyService, IPreferenceChangeListener {
6666
private ProxyManager() {
6767
try {
6868
String os = System.getProperty("osgi.os"); //$NON-NLS-1$
69-
nativeProxyProvider = switch (os) {
70-
case Constants.OS_LINUX -> new ProxyProviderLinux();
71-
case Constants.OS_WIN32 -> new ProxyProviderWin32();
72-
default -> null;
73-
};
69+
if (os != null) {
70+
nativeProxyProvider = switch (os) {
71+
case Constants.OS_LINUX -> new ProxyProviderLinux();
72+
case Constants.OS_WIN32 -> new ProxyProviderWin32();
73+
default -> null;
74+
};
75+
}
7476
} catch (Exception e) {
7577
Activator.logInfo("Problems occured during the proxy provider initialization.", e); //$NON-NLS-1$
7678
}

0 commit comments

Comments
 (0)