Permalink
Browse files

Merge pull request #387 from steipete/master

Fixes exception crash if enum is defined more than once.
  • Loading branch information...
2 parents 8aafacd + 7e6d773 commit 63e6e97215e707ad887ccb82e5f3f3a61bf8243f @robvdveer robvdveer committed Jan 6, 2014
Showing with 9 additions and 7 deletions.
  1. +9 −7 Model/GBStore.m
View
@@ -117,9 +117,10 @@ -(void)registerTypedefEnum:(GBTypedefEnumData *)typedefEnum
if ([_typedefEnums containsObject:typedefEnum]) return;
GBProtocolData *existingTypedef = [_typedefEnumsByName objectForKey:typedefEnum.nameOfEnum];
if (existingTypedef) {
- [NSException raise:@"Typedef with name %@ is already registered!", typedefEnum.nameOfEnum];
- return;
- }
+ GBLogWarn(@"Ignoring typedef enum %@, already defined.", typedefEnum);
+ return;
+ }
+
[_typedefEnums addObject:typedefEnum];
[_typedefEnumsByName setObject:typedefEnum forKey:typedefEnum.nameOfEnum];
}
@@ -130,10 +131,11 @@ - (void)registerDocument:(GBDocumentData *)document {
if ([_documents containsObject:document]) return;
NSString *name = [document.nameOfDocument stringByDeletingPathExtension];
GBDocumentData *existingDocument = [_documentsByName objectForKey:name];
- if (existingDocument) {
- [NSException raise:@"Document with name %@ is already registered!", name];
- return;
- }
+ if (existingDocument) {
+ GBLogWarn(@"Ignoring document %@, already defined.", document);
+ return;
+ }
+
[_documents addObject:document];
[_documentsByName setObject:document forKey:name];
[_documentsByName setObject:document forKey:[name stringByReplacingOccurrencesOfString:@"-template" withString:@""]];

0 comments on commit 63e6e97

Please sign in to comment.