From c8a4fd19e664b64bc3339fcf5687d8befb2f7d5e Mon Sep 17 00:00:00 2001 From: Isak Rabin Date: Wed, 31 Oct 2018 14:40:01 +0900 Subject: [PATCH] Add NULL value check --- java/Chapter 1/Question1_1/Question.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/Chapter 1/Question1_1/Question.java b/java/Chapter 1/Question1_1/Question.java index 5c5b38e8..9590ec28 100644 --- a/java/Chapter 1/Question1_1/Question.java +++ b/java/Chapter 1/Question1_1/Question.java @@ -3,6 +3,9 @@ public class Question { public static boolean isUniqueChars(String str) { + if (null==str) { + return false; + } if (str.length() > 128) { return false; } @@ -16,6 +19,9 @@ public static boolean isUniqueChars(String str) { } public static boolean isUniqueChars2(String str) { + if (null==str) { + return false; + } if (str.length() > 128) { return false; }