title: Core Data: odd crash when getting data from store
body: <p>Hia, got a one to many relation for chars and items. one char can hold a specific item, same item can be used by others.
  The CharInfo is defined as follows:</p>
  
  <pre><code>@property (nonatomic, retain) ItemInfo * slotEar;
  </code></pre>
  
  <p>CharInfo.slotEar is a reference to the item. It is optional, min count 1, max count 1 and delete rule Nulify.
  ItemInfo is defined as:</p>
  
  <pre><code>@property (nonatomic, retain) NSSet* slotEar;
  </code></pre>
  
  <p>ItemInfo.slotEar is a reference to the char. It is optional, one to many and delete rule Nulify.</p>
  
  <p>They are referencing to each other.
  There is an additional class that works with the data. It does hold the reference as well and provide it for storing.</p>
  
  <pre><code>ItemInfo *slotEar;
  </code></pre>
  
  <p>CharInfo get created before saving like this:</p>
  
  <p>When I save the CharInfo, I set the ItemInfo (from my structure) in the aproviate slot.</p>
  
  <pre><code>    CharInfo *charInfo = [NSEntityDescription
                        insertNewObjectForEntityForName:@"CharInfo" 
                        inManagedObjectContext:managedObjectContext];
  charInfo.slotEar = currentChar.slotEar;
  </code></pre>
  
  <p>Saving the context works.</p>
  
  <p>When I try to load the CharInfo from store, it works most of the time from now. After relaunching he does crash at this line.</p>
  
  <pre><code>curentChar.slotEar = charInfo.slotEar;
  </code></pre>
  
  <p>If there was no item reference (nil) then all is fine.</p>
  
  <p>Unfortunately the crash is more a halt. No error is given, he just stops at that line in the debugger and the green description next to the link says: EXC_BAD_ACCESS</p>
  
  <p>Seems something is wrong with the reference I save or the way how I try to take it from the CharInfo to my class. Any idea?</p>
  
  <p>Screenshot added:
  <img src="https://i.stack.imgur.com/9k231.png" alt="XCode4 AppCrash"></p>