diff options
author | Karsten Thoms | 2017-11-14 17:05:18 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2017-11-21 16:42:15 +0000 |
commit | 9119eed8ef0e4f698df4f540967197074d49a785 (patch) | |
tree | 681998b0aa5694b785d0b2ef0222e36b5ae770b7 | |
parent | fd699c1f9f4fb7524aa0b18db3ca45b8ad223494 (diff) | |
download | eclipse.platform.ua-9119eed8ef0e4f698df4f540967197074d49a785.tar.gz eclipse.platform.ua-9119eed8ef0e4f698df4f540967197074d49a785.tar.xz eclipse.platform.ua-9119eed8ef0e4f698df4f540967197074d49a785.zip |
Bug 527262 - Avoid NPE when Platform.getProduct() is nullI20171130-2100I20171130-2000I20171129-2000I20171128-2000I20171128-0100I20171127-2000I20171126-2000I20171125-1500I20171124-2000I20171123-2000I20171122-2000I20171121-2000
Change-Id: Icb01b5aea72cc6423324ffbeb5a829e5903c5d33
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
-rw-r--r-- | org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java | 89 |
1 files changed, 46 insertions, 43 deletions
diff --git a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java index 34e6d875d..272713f6c 100644 --- a/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java +++ b/org.eclipse.ui.intro/src/org/eclipse/ui/internal/intro/impl/model/IntroModelRoot.java @@ -278,21 +278,24 @@ public class IntroModelRoot extends AbstractIntroContainer { } private void determineHomePage() { - String pid = Platform.getProduct().getId(); - startPageId = getProcessPreference("INTRO_START_PAGE", pid); //$NON-NLS-1$ - String homePagePreference = getProcessPreference("INTRO_HOME_PAGE", pid); //$NON-NLS-1$ - homePage = rootPage; // Default, may be overridden - if (homePagePreference.length() != 0) { - AbstractIntroPage page = (AbstractIntroPage) findChild(homePagePreference, - ABSTRACT_PAGE); - if (page != null) { - homePage = page; - if(startPageId.length() == 0) { - startPageId = homePagePreference; - } - } - } - String standbyPagePreference = getProcessPreference("INTRO_STANDBY_PAGE", pid); //$NON-NLS-1$ + homePage = rootPage; // Default, may be overridden + if (Platform.getProduct() == null) { + return; + } + String pid = Platform.getProduct().getId(); + startPageId = getProcessPreference("INTRO_START_PAGE", pid); //$NON-NLS-1$ + String homePagePreference = getProcessPreference("INTRO_HOME_PAGE", pid); //$NON-NLS-1$ + if (homePagePreference.length() != 0) { + AbstractIntroPage page = (AbstractIntroPage) findChild(homePagePreference, + ABSTRACT_PAGE); + if (page != null) { + homePage = page; + if(startPageId.length() == 0) { + startPageId = homePagePreference; + } + } + } + String standbyPagePreference = getProcessPreference("INTRO_STANDBY_PAGE", pid); //$NON-NLS-1$ modelStandbyPageId = getPresentation().getStandbyPageId(); if (standbyPagePreference.length() != 0) { @@ -309,34 +312,34 @@ public class IntroModelRoot extends AbstractIntroContainer { } private void loadTheme() { - String pid = Platform.getProduct().getId(); - String themeId = getProcessPreference("INTRO_THEME", pid); //$NON-NLS-1$ - - IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); //$NON-NLS-1$ - IConfigurationElement themeElement=null; - for (int i=0; i<elements.length; i++) { - if (elements[i].getName().equals("theme")) { //$NON-NLS-1$ - String id = elements[i].getAttribute("id"); //$NON-NLS-1$ - if (themeId!=null) { - if (id!=null && themeId.equals(id)) { - // use this one - themeElement = elements[i]; - break; - } - } - else { - // see if this one is the default - String value = elements[i].getAttribute("default"); //$NON-NLS-1$ - if (value!=null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$ - themeElement = elements[i]; - break; - } - } - } - } - if (themeElement!=null) { - theme = new IntroTheme(themeElement); - } + String pid = Platform.getProduct() != null ? Platform.getProduct().getId() : null; + String themeId = pid != null ? getProcessPreference("INTRO_THEME", pid) : null; //$NON-NLS-1$ + + IConfigurationElement [] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.ui.intro.configExtension"); //$NON-NLS-1$ + IConfigurationElement themeElement=null; + for (int i=0; i<elements.length; i++) { + if (elements[i].getName().equals("theme")) { //$NON-NLS-1$ + String id = elements[i].getAttribute("id"); //$NON-NLS-1$ + if (themeId!=null) { + if (id!=null && themeId.equals(id)) { + // use this one + themeElement = elements[i]; + break; + } + } + else { + // see if this one is the default + String value = elements[i].getAttribute("default"); //$NON-NLS-1$ + if (value!=null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$ + themeElement = elements[i]; + break; + } + } + } + } + if (themeElement!=null) { + theme = new IntroTheme(themeElement); + } } /** |