From 16ce2c1630514ebddb0b2c736b0fd973d6b14dda Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Fri, 15 Mar 2013 15:47:06 -0700 Subject: [PATCH] Defensive coding. --- .../ui/refactoring/includes/IncludeOrganizer.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java index 6825718609a..69121899d38 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/IncludeOrganizer.java @@ -103,6 +103,8 @@ public class IncludeOrganizer { /** Initializes an include prototype for a new include */ IncludePrototype(IPath header, IncludeInfo includeInfo, IncludeGroupStyle style) { + if (includeInfo == null) + throw new NullPointerException(); this.header = header; this.includeInfo = includeInfo; this.style = style; @@ -115,6 +117,8 @@ public class IncludeOrganizer { */ IncludePrototype(IASTPreprocessorIncludeStatement include, IPath header, IncludeInfo includeInfo, IncludeGroupStyle style) { + if (includeInfo == null) + throw new NullPointerException(); this.existingInclude = include; this.header = header; this.includeInfo = includeInfo; @@ -146,10 +150,6 @@ public class IncludeOrganizer { return header.equals(other.header); // includeInfo is ignored if header is not null if (other.header != null) return false; - if (includeInfo == null) { - if (other.includeInfo != null) - return false; - } return includeInfo.equals(other.includeInfo); }