Fixed bug 442170: NPE in org.eclipse.jface.text.PaintManager.PositionManager.managePosition
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
index d65e70a..e815715 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/source/MatchingCharacterPainter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
  * which accompanies this distribution, and is available at
@@ -177,6 +177,7 @@
 			if (redraw)
 				handleDrawRequest(null);
 		}
+		fPreviousSelection= null;
 	}
 
 	/*
@@ -327,7 +328,7 @@
 				boolean lengthChanged= length != fPreviousLengthOfDocument;
 				fPreviousLengthOfDocument= length;
 
-				if (reason != IPainter.CONFIGURATION && fSourceViewer.getDocument() == document && !lengthChanged && selection.equals(fPreviousSelection)) {
+				if (reason != IPainter.CONFIGURATION && fSourceViewer.getDocument() == document && !lengthChanged && (selection.equals(fPreviousSelection) || fPreviousSelection == null)) {
 					return;
 				}