From 97dd7f811757f42732b246149948092cfdcfe6c7 Mon Sep 17 00:00:00 2001 From: Johann Werner Date: Wed, 19 Aug 2015 16:29:11 +0200 Subject: [PATCH] return constant for empty results --- .../er/extensions/eof/ERXEOGlobalIDUtilities.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOGlobalIDUtilities.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOGlobalIDUtilities.java index 579bb4fb6e8..6c863f5ee7e 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOGlobalIDUtilities.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/eof/ERXEOGlobalIDUtilities.java @@ -160,6 +160,9 @@ public static NSDictionary> globalIDsGroupedByEntity * @param globalIDs */ public static NSArray primaryKeyValuesWithGlobalIDs(NSArray globalIDs) { + if (globalIDs == null || globalIDs.count() == 0) { + return NSArray.emptyArray(); + } NSMutableArray result = new NSMutableArray(globalIDs.count()); NSDictionary> gidsByEntity = globalIDsGroupedByEntityName(globalIDs); for (String entityName : gidsByEntity.keySet()) { @@ -186,6 +189,9 @@ public static NSArray primaryKeyValuesWithGlobalIDs(NSArray * @param values */ public static NSArray globalIDsWithPrimaryKeyValues(String entityName, NSArray values) { + if (values == null || values.count() == 0) { + return NSArray.emptyArray(); + } NSMutableArray result = new NSMutableArray(values.count()); for (Object value : values) { EOKeyGlobalID gid = EOKeyGlobalID.globalIDWithEntityName(entityName, new Object[] {value}); @@ -299,6 +305,9 @@ public static NSMutableArray fetchObjectsWithGlobalIDs(EOEdi * @param prefetchingKeypaths */ public static NSArray fireFaultsForGlobalIDs(EOEditingContext ec, NSArray globalIDs, NSArray prefetchingKeypaths) { + if (globalIDs == null || globalIDs.count() == 0) { + return NSArray.emptyArray(); + } NSMutableArray result = new NSMutableArray(globalIDs.count()); NSMutableArray faults = new NSMutableArray(globalIDs.count()); for (EOGlobalID gid : globalIDs) {