From 8fa3f6c822909039fdc45d97852e4580e422eb5e Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 4 Oct 2017 15:27:52 +0300 Subject: [PATCH] diff: do not throw exception if unversioned file is no longer valid --- .../changes/actions/diff/UnversionedDiffRequestProducer.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/UnversionedDiffRequestProducer.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/UnversionedDiffRequestProducer.java index d653b36b759e..4518f2ada853 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/UnversionedDiffRequestProducer.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/actions/diff/UnversionedDiffRequestProducer.java @@ -80,6 +80,7 @@ public class UnversionedDiffRequestProducer implements ChangeDiffRequestChain.Pr @Override public DiffRequest process(@NotNull UserDataHolder context, @NotNull ProgressIndicator indicator) throws DiffRequestProducerException, ProcessCanceledException { + if (!myFile.isValid()) throw new DiffRequestProducerException("Can't show diff - file not found"); return createRequest(myProject, myFile); } @@ -90,7 +91,7 @@ public class UnversionedDiffRequestProducer implements ChangeDiffRequestChain.Pr } @NotNull - public static DiffRequest createRequest(@Nullable Project project, @NotNull VirtualFile file) { + private static DiffRequest createRequest(@Nullable Project project, @NotNull VirtualFile file) { DiffContentFactory contentFactory = DiffContentFactory.getInstance(); DiffContent content1 = contentFactory.createEmpty(); DiffContent content2 = contentFactory.create(project, file);