Bug 560263 - Ctrl+3 not working due NPE after ActionElement.getLabel
LegacyActionTools.removeMnemonics(String) should not fail on null or
empty input, many clients don't expect that - simply return empty
string.
Change-Id: Ib3ef6c82cea9d67b2ab6dd54659ebd7996aabd69
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
index c56190c..def61ad 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/LegacyActionTools.java
@@ -730,9 +730,12 @@
* <code>"Open"</code>.
*
* @param text the text
- * @return the text sans mnemonics
+ * @return the text sans mnemonics, or empty string
*/
public static String removeMnemonics(final String text) {
+ if (text == null || text.isEmpty()) {
+ return ""; //$NON-NLS-1$
+ }
int index = text.indexOf('&');
if (index == -1) {
return text;