diff --git a/reader/src/main/java/org/jline/reader/Candidate.java b/reader/src/main/java/org/jline/reader/Candidate.java index d32e98683..c09c0561b 100644 --- a/reader/src/main/java/org/jline/reader/Candidate.java +++ b/reader/src/main/java/org/jline/reader/Candidate.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2018, the original author or authors. + * Copyright (c) 2002-2019, the original author or authors. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. @@ -46,9 +46,8 @@ public Candidate(String value) { * @param complete the complete flag */ public Candidate(String value, String displ, String group, String descr, String suffix, String key, boolean complete) { - Objects.requireNonNull(value); - this.value = value; - this.displ = displ; + this.value = Objects.requireNonNull(value); + this.displ = Objects.requireNonNull(displ); this.group = group; this.descr = descr; this.suffix = suffix; diff --git a/terminal/src/main/java/org/jline/utils/Display.java b/terminal/src/main/java/org/jline/utils/Display.java index 4ac2ed7b7..748f85029 100644 --- a/terminal/src/main/java/org/jline/utils/Display.java +++ b/terminal/src/main/java/org/jline/utils/Display.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2018, the original author or authors. + * Copyright (c) 2002-2019, the original author or authors. * * This software is distributable under the BSD license. See the terms of the * BSD license in the documentation provided with this software. @@ -488,7 +488,7 @@ void rawPrint(AttributedString str) { } public int wcwidth(String str) { - return AttributedString.fromAnsi(str).columnLength(); + return str != null ? AttributedString.fromAnsi(str).columnLength() : 0; } }