Skip to content

Commit

Permalink
Fix NPE exception in occurrence updater
Browse files Browse the repository at this point in the history
I'm not sure why this exception occurs but I guess that whenever an
editor is closed, its compilation unit is removed but the job for the update occurrences feature may still be running. We just need to check if null is returned and do nothing in this case.
  • Loading branch information
kiritsuku committed Oct 9, 2014
1 parent b0899a6 commit fa85506
Showing 1 changed file with 5 additions and 3 deletions.
Expand Up @@ -225,9 +225,11 @@ class ScalaSourceFileEditor extends CompilationUnitEditor with ScalaCompilationU
}

EclipseUtils.scheduleJob("Updating occurrence annotations", priority = Job.DECORATE) { monitor =>
val fileName = getInteractiveCompilationUnit.file.name
Utils.debugTimed("Time elapsed for \"updateOccurrences\" in source " + fileName) {
performOccurrencesUpdate(selection, lastModified)
Option(getInteractiveCompilationUnit) foreach { cu =>
val fileName = cu.file.name
Utils.debugTimed("Time elapsed for \"updateOccurrences\" in source " + fileName) {
performOccurrencesUpdate(selection, lastModified)
}
}
Status.OK_STATUS
}
Expand Down

0 comments on commit fa85506

Please sign in to comment.