Skip to content

Commit

Permalink
Fix a NullPointerException when calling the EOModel.createPrototypeCa…
Browse files Browse the repository at this point in the history
…che method from the wrong EOModel

The `ERXModelGroup` class may create duplicate models in some cases. They are not added to the model group, but their presence may cause problems. The root cause of this problem is related to the duplication of `NSBundle` references while loading `EOModel`s. This fix uses a `NSMutableSet` instead of a `NSMutableArray` to hold the references to all loaded bundles. It avoids the presence of duplicate bundles and therefore the presence of duplicate model references.

One can find more information about the issue at the above link.

hprange/wounit#35
  • Loading branch information
hprange committed Mar 15, 2014
1 parent e0339cb commit 6ce6a3c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void loadModelsFromLoadedBundles() {

NSMutableDictionary<String, URL> modelNameURLDictionary = new NSMutableDictionary<String, URL>();
NSMutableArray<String> modelNames = new NSMutableArray<String>();
NSMutableArray<NSBundle> bundles = new NSMutableArray<NSBundle>();
NSMutableSet<NSBundle> bundles = new NSMutableSet<NSBundle>();
bundles.addObject(NSBundle.mainBundle());
bundles.addObjectsFromArray(frameworkBundles);

Expand Down

0 comments on commit 6ce6a3c

Please sign in to comment.