Commits

Jason Harris committed 4d89ab4

- Addresses issue 181. Protect against nil or corrupt dates.

Comments (0)

Files changed (4)

Classes/LogEntryModel/LogEntry.h

 - (NSString*) shortDate;
 - (NSString*) fullDate;
 - (NSString*) isoDate;
+- (NSDate*)   rawDate;
 
 
 // Presentation of Entry

Classes/LogEntryModel/LogEntry.m

 - (NSString*) shortDate			{ return [fullRecord_ shortDate]; }
 - (NSString*) fullDate			{ return [fullRecord_ fullDate]; }
 - (NSString*) isoDate			{ return [fullRecord_ isoDate]; }
+- (NSDate*)   rawDate			{ return [fullRecord_ rawDate]; }
 
 
 
 //		[verboseEntry appendAttributedString: normalAttributedString(fstr(@"%@\n", children_))];
 //	}
 	
+	if (![self isFullyLoaded])
+		return verboseEntry;
+
 	if (stringIsNonWhiteSpace([self fullAuthor]))
 	{
 		[verboseEntry appendAttributedString: categoryAttributedString(@"Author:\t")];
 		[verboseEntry appendAttributedString: normalAttributedString(fstr(@"%@\n", nonNil([self author])))];
 	}
 	
-	if (YES)
+	if (IsNotEmpty([self rawDate]))
 	{
 		[verboseEntry appendAttributedString: categoryAttributedString(@"Date:\t")];
 		[verboseEntry appendAttributedString: normalAttributedString(fstr(@"%@   ", [self shortDate]))];

Classes/LogEntryModel/LogRecord.h

 - (NSString*) shortDate;
 - (NSString*) fullDate;
 - (NSString*) isoDate;
+- (NSDate*)   rawDate;
 
 
 //+ (LogRecord*) fullyLoadRecordForChangeset:(NSString*)changeset andRepository:(RepositoryData*)repository;

Classes/LogEntryModel/LogRecord.m

 	return [dateFormatter stringFromDate:date_];
 }
 
+- (NSDate*) rawDate { return date_; }
+
 - (NSString*) isoDate { return [date_ isodateDescription]; }
 
 - (void) setDate:(NSString*)dateString