diff --git a/Classes/GTIndexEntry.m b/Classes/GTIndexEntry.m index b062eb9b8..472442066 100644 --- a/Classes/GTIndexEntry.m +++ b/Classes/GTIndexEntry.m @@ -61,6 +61,9 @@ - (void)dealloc { @synthesize repository; + (id)indexEntryWithEntry:(git_index_entry *)theEntry { + if (theEntry == NULL) + return nil; + return [[self alloc] initWithEntry:theEntry]; } @@ -73,8 +76,11 @@ - (id)init { - (id)initWithEntry:(git_index_entry *)theEntry { if((self = [self init])) { - git_index_entry *thisEntry = self.git_index_entry; - memcpy(thisEntry, theEntry, sizeof(git_index_entry)); + if (theEntry) + { + git_index_entry *thisEntry = self.git_index_entry; + memcpy(thisEntry, theEntry, sizeof(git_index_entry)); + } } return self; }