Skip to content

Commit

Permalink
Merge pull request #13 from mattquiros/master
Browse files Browse the repository at this point in the history
Fixed insertion errors where insertion index is wrong
  • Loading branch information
Brandon McQuilkin committed Jun 9, 2014
2 parents 648b615 + b1d6cff commit 9d5d84b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
Binary file modified .DS_Store
Binary file not shown.
11 changes: 3 additions & 8 deletions M13OrderedDictionary.m
Original file line number Diff line number Diff line change
Expand Up @@ -920,18 +920,13 @@ - (void)addEntriesFromDictionary:(NSDictionary *)dictionary

- (void)insertObject:(id)object pairedWithKey:(id<NSCopying>)key atIndex:(NSUInteger)index
{
NSInteger idx = 0;
if ([pairs objectForKey:key] != nil) {
if (index < [self indexOfKey:key]) {
idx = index - 1;
} else {
idx = index;
}
[self removeEntryWithKey:key];
}

[pairs setObject:object forKey:key];
[keys insertObject:key atIndex:idx];
[objects insertObject:object atIndex:idx];
[keys insertObject:key atIndex:index];
[objects insertObject:object atIndex:index];
}

- (void)insertEntry:(NSDictionary *)entry atIndex:(NSUInteger)index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>87933A7B-DEEA-45D2-A9C9-ECFD42622B81</string>
<string>A2290859-C43C-433C-B549-1EE23115D3CB</string>
<key>IDESourceControlProjectName</key>
<string>M13OrderedDictionary</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>2A58D87D-0C3D-4E3E-B996-44464EA9164D</key>
<string>https://github.com/Marxon13/M13OrderedDictionary.git</string>
<key>5CBA84AC-2517-437E-8596-079CE4775AC9</key>
<string>https://github.com/mattquiros/M13OrderedDictionary.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>M13OrderedDictionary.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>2A58D87D-0C3D-4E3E-B996-44464EA9164D</key>
<key>5CBA84AC-2517-437E-8596-079CE4775AC9</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/Marxon13/M13OrderedDictionary.git</string>
<string>https://github.com/mattquiros/M13OrderedDictionary.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>2A58D87D-0C3D-4E3E-B996-44464EA9164D</string>
<string>5CBA84AC-2517-437E-8596-079CE4775AC9</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>2A58D87D-0C3D-4E3E-B996-44464EA9164D</string>
<string>5CBA84AC-2517-437E-8596-079CE4775AC9</string>
<key>IDESourceControlWCCName</key>
<string>M13OrderedDictionary</string>
</dict>
Expand Down

0 comments on commit 9d5d84b

Please sign in to comment.