From b3ca2daf60098062c517531d0d66cc091289a5d6 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Fri, 2 Jun 2017 20:02:32 +0300 Subject: [PATCH] [shelf]: fix NPE for binary file deletion preview, use nullable context --- .../openapi/vcs/changes/shelf/ShelvedChangesViewManager.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java index e3b076722bc8..a811a1a7c1ab 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/shelf/ShelvedChangesViewManager.java @@ -820,11 +820,14 @@ public class ShelvedChangesViewManager implements ProjectComponent { try { ShelvedChange shelvedChange = provider.getShelvedChange(); if (shelvedChange != null) { - return new PatchDiffRequest(createAppliedTextPatch(myPreloader.getPatch(shelvedChange, new CommitContext()))); + return new PatchDiffRequest(createAppliedTextPatch(myPreloader.getPatch(shelvedChange, null))); } DiffContentFactoryEx factory = DiffContentFactoryEx.getInstanceEx(); ShelvedBinaryFile binaryFile = assertNotNull(provider.getBinaryFile()); + if (binaryFile.AFTER_PATH == null) { + throw new DiffRequestProducerException("Content for '" + getRequestName(provider) + "' was removed"); + } byte[] binaryContent = binaryFile.createBinaryContentRevision(myProject).getBinaryContent(); FileType fileType = VcsUtil.getFilePath(binaryFile.SHELVED_PATH).getFileType(); return new SimpleDiffRequest(getRequestName(provider), factory.createEmpty(),