diff --git a/CHANGELOG.md b/CHANGELOG.md
index c1ea25e7..8e43dc52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
- Fixed "You are editing..." message display conditions [\#351](https://github.com/hsz/idea-gitignore/issues/351) [\#352](https://github.com/hsz/idea-gitignore/issues/352) [\#356](https://github.com/hsz/idea-gitignore/issues/356)
- It's prohibited to access index during event dispatching [\#358](https://github.com/hsz/idea-gitignore/issues/358) [\#355](https://github.com/hsz/idea-gitignore/issues/355) [\#369](https://github.com/hsz/idea-gitignore/issues/369)
- Already disposed: com.intellij.util.messages.impl.MessageBusImpl [\#360](https://github.com/hsz/idea-gitignore/issues/360)
+- NotNull error when changing directory name [\##391](https://github.com/hsz/idea-gitignore/issues/#391)
## [v1.7.6](https://github.com/hsz/idea-gitignore/tree/v1.7.6) (2017-02-23)
diff --git a/README.md b/README.md
index 4214aa1d..6ea79080 100644
--- a/README.md
+++ b/README.md
@@ -131,6 +131,7 @@ Changelog
- Fixed "You are editing..." message display conditions [\#351](https://github.com/hsz/idea-gitignore/issues/351) [\#352](https://github.com/hsz/idea-gitignore/issues/352) [\#356](https://github.com/hsz/idea-gitignore/issues/356)
- It's prohibited to access index during event dispatching [\#358](https://github.com/hsz/idea-gitignore/issues/358) [\#355](https://github.com/hsz/idea-gitignore/issues/355) [\#369](https://github.com/hsz/idea-gitignore/issues/369)
- Already disposed: com.intellij.util.messages.impl.MessageBusImpl [\#360](https://github.com/hsz/idea-gitignore/issues/360)
+- NotNull error when changing directory name [\##391](https://github.com/hsz/idea-gitignore/issues/#391)
[Full Changelog History](./CHANGELOG.md)
diff --git a/resources/META-INF/plugin.xml b/resources/META-INF/plugin.xml
index 0a0bda33..d212ef8e 100644
--- a/resources/META-INF/plugin.xml
+++ b/resources/META-INF/plugin.xml
@@ -97,6 +97,7 @@
Fixed "You are editing..." message display conditions (351, 352, 356)
It's prohibited to access index during event dispatching (358, 355, 369)
Already disposed: com.intellij.util.messages.impl.MessageBusImpl (360)
+ NotNull error when changing directory name (391)
Full Changelog History
diff --git a/resources/messages/IgnoreBundle.properties b/resources/messages/IgnoreBundle.properties
index fb18a9de..d3fc9d5b 100644
--- a/resources/messages/IgnoreBundle.properties
+++ b/resources/messages/IgnoreBundle.properties
@@ -168,6 +168,7 @@ Fixes:
\
- Fixed "You are editing..." message display conditions (#351, #352, #356)
\
- It's prohibited to access index during event dispatching (#358, #355, #369)
\
- Already disposed: com.intellij.util.messages.impl.MessageBusImpl (#360)
\
+- NotNull error when changing directory name (#391)
\
\
If you find my plugin helpful, donate me using
\
PayPal or \
diff --git a/src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java b/src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java
index c9a976a8..4717986a 100644
--- a/src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java
+++ b/src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java
@@ -69,6 +69,7 @@ public class IgnoreFileGroupAction extends ActionGroup {
private final String presentationTextSingleKey;
/** {@link Project}'s base directory. */
+ @Nullable
private VirtualFile baseDir;
/**
@@ -139,7 +140,7 @@ public AnAction[] getChildren(@Nullable AnActionEvent e) {
AnAction[] actions;
int count = countFiles();
- if (count == 0) {
+ if (count == 0 || baseDir == null) {
actions = new AnAction[0];
} else {
actions = new AnAction[count];
diff --git a/src/mobi/hsz/idea/gitignore/codeInspection/IgnoreUnusedEntryInspection.java b/src/mobi/hsz/idea/gitignore/codeInspection/IgnoreUnusedEntryInspection.java
index cf59df82..71c48163 100644
--- a/src/mobi/hsz/idea/gitignore/codeInspection/IgnoreUnusedEntryInspection.java
+++ b/src/mobi/hsz/idea/gitignore/codeInspection/IgnoreUnusedEntryInspection.java
@@ -113,6 +113,10 @@ private boolean isEntryExcluded(@NotNull IgnoreEntry entry, @NotNull Project pro
final List matched = ContainerUtil.newArrayList();
final Collection files = cache.getFilesForPattern(project, pattern);
+ if (projectRoot == null) {
+ return false;
+ }
+
for (final VirtualFile root : Utils.getExcludedRoots(project)) {
for (VirtualFile file : files) {
if (!Utils.isUnder(file, root)) {
diff --git a/src/mobi/hsz/idea/gitignore/reference/IgnoreReferenceSet.java b/src/mobi/hsz/idea/gitignore/reference/IgnoreReferenceSet.java
index 9c30c82f..d205e73c 100644
--- a/src/mobi/hsz/idea/gitignore/reference/IgnoreReferenceSet.java
+++ b/src/mobi/hsz/idea/gitignore/reference/IgnoreReferenceSet.java
@@ -264,7 +264,7 @@ public boolean visitFile(@NotNull VirtualFile file) {
continue;
}
- String name = (root != null) ? Utils.getRelativePath(root, file) : file.getName();
+ final String name = (root != null) ? Utils.getRelativePath(root, file) : file.getName();
if (MatcherUtil.match(matcher, name)) {
PsiFileSystemItem psiFileSystemItem = getPsiFileSystemItem(manager, file);
if (psiFileSystemItem == null) {