NPE in git status bar widget [max]

This commit is contained in:
Kirill Kalishev
2010-12-07 18:54:01 +03:00
parent b4838f18c3
commit 035e86aba4
2 changed files with 9 additions and 0 deletions
@@ -38,6 +38,7 @@ public abstract class EditorBasedWidget extends FileEditorManagerAdapter impleme
private Project myProject;
protected MessageBusConnection myConnection;
private boolean myDisposed;
protected EditorBasedWidget(Project project) {
myProject = project;
@@ -106,6 +107,8 @@ public abstract class EditorBasedWidget extends FileEditorManagerAdapter impleme
@Override
public void dispose() {
myDisposed = true;
myStatusBar = null;
if (myConnection != null) {
myConnection.disconnect();
@@ -113,4 +116,8 @@ public abstract class EditorBasedWidget extends FileEditorManagerAdapter impleme
}
myProject = null;
}
protected final boolean isDisposed() {
return myDisposed;
}
}
@@ -127,6 +127,8 @@ public class GitCurrentBranchWidget extends EditorBasedWidget implements StatusB
Task.Backgroundable task = new Task.Backgroundable(project, "") {
@Override
public void run(ProgressIndicator indicator) {
if (isDisposed()) return;
String currentBranchName = null;
if (file != null) {
AbstractVcs vcs = myVcsManager.getVcsFor(file);