Bug 573458 - Possible NPE in GMatchImpl::getReferenceOrderDifference

Change-Id: Ic42e78e29911e91323ad0a258ed4b3ea85e4add9
Signed-off-by: Olivier Constant <olivier.constant@thalesgroup.com>
diff --git a/plugins/org.eclipse.emf.diffmerge.generic/src/org/eclipse/emf/diffmerge/generic/gdiffdata/impl/GMatchImpl.java b/plugins/org.eclipse.emf.diffmerge.generic/src/org/eclipse/emf/diffmerge/generic/gdiffdata/impl/GMatchImpl.java
index 6aeb72d..2f3f6c0 100644
--- a/plugins/org.eclipse.emf.diffmerge.generic/src/org/eclipse/emf/diffmerge/generic/gdiffdata/impl/GMatchImpl.java
+++ b/plugins/org.eclipse.emf.diffmerge.generic/src/org/eclipse/emf/diffmerge/generic/gdiffdata/impl/GMatchImpl.java
@@ -901,9 +901,11 @@
     if (referenceMap != null) {
       List<IReferenceValuePresence<E>> forReference = referenceMap
           .get(reference_p);
-      for (IReferenceValuePresence<E> orderDifference : forReference) {
-        if (orderDifference.getPresenceRole() == role_p) {
-          return orderDifference;
+      if (forReference != null) {
+        for (IReferenceValuePresence<E> orderDifference : forReference) {
+          if (orderDifference.getPresenceRole() == role_p) {
+            return orderDifference;
+          }
         }
       }
     }