boolean () { if (pointers.isEmpty()) { return false; } SmartPsiElementPointer<?> pointer = pointers.get(0); VirtualFile virtualFile = pointer.getVirtualFile(); Project expectedProject = virtualFile == null ? null : ProjectLocator.getInstance().guessProjectForFile(virtualFile); if (expectedProject != null && expectedProject != project) { // files must have moved between projects, everything is invalid, and pointer.getElement() would likely crash return false; } return pointer.getElement() != null; }