Skip to content

Commit

Permalink
Add null check for haystack arg.
Browse files Browse the repository at this point in the history
  • Loading branch information
baconmania committed Dec 21, 2017
1 parent 1c6e964 commit f1fd6e6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

import java.io.IOException;
import java.util.List;
import java.util.Objects;

import com.github.jknack.handlebars.Options;

public class IfContainedInHelperSource {

public static CharSequence ifContainedIn(List<String> haystack, String needle, Options options) throws IOException {
if (Objects.isNull(haystack)) {
return options.inverse();
}

for (String element : haystack) {
if (element.contains(needle)) {
return options.fn();
Expand Down

0 comments on commit f1fd6e6

Please sign in to comment.