[309980] NPE when typing at the end of a document
diff --git a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/text/CharacterPairInserter.java b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/text/CharacterPairInserter.java
index 858f033..b418adc 100644
--- a/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/text/CharacterPairInserter.java
+++ b/bundles/org.eclipse.wst.html.ui/src/org/eclipse/wst/html/ui/internal/text/CharacterPairInserter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2009 IBM Corporation and others.

+ * Copyright (c) 2009, 2010 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

@@ -54,7 +54,7 @@
 			IStructuredDocumentRegion[] regions = ((IStructuredDocument) doc).getStructuredDocumentRegions(offset, 0);

 			if (regions != null && regions.length > 0) {

 				ITextRegion region = regions[0].getRegionAtCharacterOffset(offset);

-				return region.getType() != DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE;

+				return region != null && region.getType() != DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE;

 			}

 		}

 		return true;

diff --git a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/text/CharacterPairInserter.java b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/text/CharacterPairInserter.java
index fd4b5bc..2f61324 100644
--- a/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/text/CharacterPairInserter.java
+++ b/bundles/org.eclipse.wst.xml.ui/src/org/eclipse/wst/xml/ui/internal/text/CharacterPairInserter.java
@@ -1,5 +1,5 @@
 /*******************************************************************************

- * Copyright (c) 2009 IBM Corporation and others.

+ * Copyright (c) 2009, 2010 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

@@ -54,7 +54,7 @@
 			IStructuredDocumentRegion[] regions = ((IStructuredDocument) doc).getStructuredDocumentRegions(offset, 0);

 			if (regions != null && regions.length > 0) {

 				ITextRegion region = regions[0].getRegionAtCharacterOffset(offset);

-				return region.getType() != DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE;

+				return region != null && region.getType() != DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE;

 			}

 		}

 		return true;