diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightInfoProcessor.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightInfoProcessor.java index b75e4a1a8f08..04d5f22615c7 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightInfoProcessor.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DefaultHighlightInfoProcessor.java @@ -24,8 +24,6 @@ import com.intellij.openapi.editor.ex.MarkupModelEx; import com.intellij.openapi.editor.impl.DocumentMarkupModel; import com.intellij.openapi.editor.impl.EditorMarkupModelImpl; import com.intellij.openapi.editor.markup.MarkupModel; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.ProperTextRange; import com.intellij.openapi.util.TextRange; @@ -128,7 +126,6 @@ public class DefaultHighlightInfoProcessor extends HighlightInfoProcessor { final Project project = psiFile.getProject(); final Document document = PsiDocumentManager.getInstance(project).getDocument(psiFile); if (document == null) return; - final ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator(); DaemonCodeAnalyzerEx .processHighlights(document, project, null, range.getStartOffset(), range.getEndOffset(), new Processor() { @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java index 0107c95bee32..0a81531954c9 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/DocumentFoldingInfo.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -257,7 +257,7 @@ class DocumentFoldingInfo implements JDOMExternalizable, CodeFoldingState { continue; } PsiElement restoredElement = FoldingPolicy.restoreBySignature(psiFile, signature); - if (restoredElement != null) { + if (restoredElement != null && restoredElement.isValid()) { myPsiElements.add(SmartPointerManager.getInstance(myProject).createSmartPsiElementPointer(restoredElement)); FoldingInfo fi = new FoldingInfo(DEFAULT_PLACEHOLDER, expanded); restoredElement.putUserData(FOLDING_INFO_KEY, fi);