From 43bb77aa00e2c5228703f15e408bc182e3c355b9 Mon Sep 17 00:00:00 2001 From: hsz Date: Fri, 13 Apr 2018 13:58:40 +0200 Subject: [PATCH] Fixed #533 IndexOutOfBoundsException --- src/mobi/hsz/idea/gitignore/util/Glob.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/mobi/hsz/idea/gitignore/util/Glob.java b/src/mobi/hsz/idea/gitignore/util/Glob.java index 8e0579fe..210a406c 100644 --- a/src/mobi/hsz/idea/gitignore/util/Glob.java +++ b/src/mobi/hsz/idea/gitignore/util/Glob.java @@ -69,7 +69,11 @@ private Glob() { @Nullable public static VirtualFile findOne(@NotNull final VirtualFile root, @NotNull IgnoreEntry entry, @NotNull MatcherUtil matcher) { - return find(root, ContainerUtil.newArrayList(entry), matcher, false).get(entry).get(0); + List files = find(root, ContainerUtil.newArrayList(entry), matcher, false).get(entry); + if (files == null || files.isEmpty()) { + return null; + } + return files.get(0); } /**