You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by io...@apache.org on 2011/11/29 18:27:47 UTC

svn commit: r1207983 - /karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java

Author: iocanel
Date: Tue Nov 29 17:27:46 2011
New Revision: 1207983

URL: http://svn.apache.org/viewvc?rev=1207983&view=rev
Log:
[KARAF-1029] Added a check to avoid possible NPEs.

Modified:
    karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java

Modified: karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java
URL: http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java?rev=1207983&r1=1207982&r2=1207983&view=diff
==============================================================================
--- karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java (original)
+++ karaf/branches/karaf-2.2.x/shell/console/src/main/java/org/apache/karaf/shell/console/completer/ArgumentCompleter.java Tue Nov 29 17:27:46 2011
@@ -267,16 +267,17 @@ public class ArgumentCompleter implement
                     if (option != null) {
                         Completer optionValueCompleter = null;
                         String name = option.name();
-                        optionValueCompleter = optionalCompleters.get(name);
-                        if(optionValueCompleter == null) {
-                            String[] aliases = option.aliases();
-                            if(aliases.length > 0 ) {
-                                for(int i=0; i < aliases.length && optionValueCompleter == null; i++) {
-                                    optionValueCompleter = optionalCompleters.get(option.aliases()[i]);
+                        if (optionalCompleters != null && name != null) {
+                            optionValueCompleter = optionalCompleters.get(name);
+                            if (optionValueCompleter == null) {
+                                String[] aliases = option.aliases();
+                                if (aliases.length > 0) {
+                                    for (int i = 0; i < aliases.length && optionValueCompleter == null; i++) {
+                                        optionValueCompleter = optionalCompleters.get(option.aliases()[i]);
+                                    }
                                 }
                             }
                         }
-
                         if(optionValueCompleter != null) {
                             comp = optionValueCompleter;
                         }