From 2f6d8afd129c360ab1fca18649cf55fce7883153 Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 10 Jul 2008 21:24:26 +0000 Subject: [PATCH] [240414] NPE in SystemHistoryCombo --- .../internal/ui/dialogs/SystemWorkWithHistoryDialog.java | 7 ++++--- .../UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java index ab136ca8973..5f7ef3aff00 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemWorkWithHistoryDialog.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2002, 2007 IBM Corporation and others. + * Copyright (c) 2002, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * David McKnight (IBM) - [240414] NPE in SystemHistoryCombo *******************************************************************************/ package org.eclipse.rse.internal.ui.dialogs; @@ -164,7 +164,8 @@ public class SystemWorkWithHistoryDialog extends SystemPromptDialog implements mdnMI = createMenuItem(SystemResources.ACTION_HISTORY_MOVEDOWN_LABEL, SystemResources.ACTION_HISTORY_MOVEDOWN_TOOLTIP); historyList.setMenu(popupMenu); - historyList.setItems(historyInput); + if (historyInput != null) + historyList.setItems(historyInput); clearButton.setEnabled((historyInput!=null) && (historyInput.length>0)); rmvButton.setEnabled(false); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java index f63ef0c9743..839734679d8 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - moved SystemPreferencesManager to a new package * David Dykstal (IBM) - [226561] Add API markup for noextend / noimplement where needed + * David McKnight (IBM) - [240414] NPE in SystemHistoryCombo ********************************************************************************/ package org.eclipse.rse.ui.widgets; @@ -109,7 +110,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave this.maxComboEntries = maxComboEntries; createHistoryButton(); String[] history = getHistory(); - if (history.length > 0) + if (history != null && history.length > 0) setItems(history); addOurButtonSelectionListener(); } @@ -288,7 +289,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave { this.historyKey = key; String[] history = getHistory(); - if (history.length > 0) + if (history != null && history.length > 0) setItems(history); else historyCombo.removeAll();