diff --git a/lib/views/staging-view.js b/lib/views/staging-view.js index fc1963a359..df3b59a3f6 100644 --- a/lib/views/staging-view.js +++ b/lib/views/staging-view.js @@ -436,11 +436,12 @@ export default class StagingView { // due to changes being fully staged/unstaged/stashed/deleted/etc return this.props.workspace.getPanes().filter(pane => { const pendingItem = pane.getPendingItem(); - if (!pendingItem) { return false; } - const isDiffViewItem = pendingItem.getRealItem && pendingItem.getRealItem() instanceof FilePatchController; + if (!pendingItem || !pendingItem.getRealItem) { return false; } + const realItem = pendingItem.getRealItem(); + const isDiffViewItem = realItem instanceof FilePatchController; // We only want to update pending diff views for currently active repo - const isInActiveRepo = pendingItem.getWorkingDirectory() === this.props.workingDirectoryPath; - const isStale = !this.changedFileExists(pendingItem.getFilePath(), pendingItem.getStagingStatus()); + const isInActiveRepo = realItem.getWorkingDirectory() === this.props.workingDirectoryPath; + const isStale = !this.changedFileExists(realItem.getFilePath(), realItem.getStagingStatus()); return isDiffViewItem && isInActiveRepo && isStale; }); }