Protect against null pointer for BaseCommand
Subclasses of BaseCommand may not initialize argv field (e.g. ScpCommand). Recent change [1] uses argv field which may result in NPE. This change will guard the code from such error. [1]: https://gerrit-review.googlesource.com/c/gerrit/+/146191 Change-Id: I6dd3afa08fd696d25741b5bdec8530deac422261 Signed-off-by: Ardo Septama <aseptama@gmail.com>
This commit is contained in:
parent
5adfe0610f
commit
dfa74b835f
@ -414,6 +414,9 @@ public abstract class BaseCommand implements Command {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void maskSensitiveParameters() {
|
private void maskSensitiveParameters() {
|
||||||
|
if (argv == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
sensitiveParameters = cache.get(this.getClass());
|
sensitiveParameters = cache.get(this.getClass());
|
||||||
maskedArgv = new ArrayList<>();
|
maskedArgv = new ArrayList<>();
|
||||||
maskedArgv.add(commandName);
|
maskedArgv.add(commandName);
|
||||||
|
Loading…
Reference in New Issue
Block a user