aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzzhongwei2013-03-12 23:01:43 (EDT)
committerzzhongwei2013-03-12 23:01:43 (EDT)
commitca8a755f0625614d4da0529d06718cb7459ec37e (patch)
tree0d282c659fafdc81bb90350c1dc94747c0f4ac8c
parentb429c5bf8e75aa3bcb86f09ed549e20423dcbdb9 (diff)
downloadorg.eclipse.pdt-ca8a755f0625614d4da0529d06718cb7459ec37e.zip
org.eclipse.pdt-ca8a755f0625614d4da0529d06718cb7459ec37e.tar.gz
org.eclipse.pdt-ca8a755f0625614d4da0529d06718cb7459ec37e.tar.bz2
fix NPE
-rw-r--r--plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/NamespaceAbstractPHPDocTagStartContext.java25
1 files changed, 14 insertions, 11 deletions
diff --git a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/NamespaceAbstractPHPDocTagStartContext.java b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/NamespaceAbstractPHPDocTagStartContext.java
index 9f11ef5..c765e09 100644
--- a/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/NamespaceAbstractPHPDocTagStartContext.java
+++ b/plugins/org.eclipse.php.core/src/org/eclipse/php/internal/core/codeassist/contexts/NamespaceAbstractPHPDocTagStartContext.java
@@ -118,18 +118,21 @@ public abstract class NamespaceAbstractPHPDocTagStartContext extends
currentNS = null;
try {
- IType type = (IType) sourceModule.getElementAt(offset)
- .getAncestor(IModelElement.TYPE);
- if (type.getParent() instanceof IType) {
- type = (IType) type.getParent();
- }
- if (type != null && (PHPFlags.isNamespace(type.getFlags()))) {
- currentNS = type;
- fullName = NamespaceReference.NAMESPACE_SEPARATOR
- + currentNS.getElementName()
- + NamespaceReference.NAMESPACE_SEPARATOR + lastWord;
- } else {
+ if (sourceModule.getElementAt(offset) != null) {
+ IType type = (IType) sourceModule.getElementAt(offset)
+ .getAncestor(IModelElement.TYPE);
+ if (type.getParent() instanceof IType) {
+ type = (IType) type.getParent();
+ }
+ if (type != null && (PHPFlags.isNamespace(type.getFlags()))) {
+ currentNS = type;
+ fullName = NamespaceReference.NAMESPACE_SEPARATOR
+ + currentNS.getElementName()
+ + NamespaceReference.NAMESPACE_SEPARATOR
+ + lastWord;
+ } else {
+ }
}
} catch (ModelException e1) {
e1.printStackTrace();