diff --git a/ChangeLog b/ChangeLog index 25d7ba8f4..a1e680c52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-10-01 02:21 Alexander Malmberg + + * Source/NSUserDefaults.m (-synchronize): Handle lockDate being nil. + 2002-09-30 Richard Frith-Macdonald * NSTimeZones/NSTimeZones.tar: Updated to latest information. diff --git a/Source/NSUserDefaults.m b/Source/NSUserDefaults.m index 18389d9a4..eeacf93fe 100644 --- a/Source/NSUserDefaults.m +++ b/Source/NSUserDefaults.m @@ -1184,10 +1184,18 @@ static NSString *pathForUser(NSString *user) while ([_fileLock tryLock] == NO) { CREATE_AUTORELEASE_POOL(arp); - NSDate *when; + NSDate *when, *lockDate; + lockDate = [_fileLock lockDate]; + /* If the lock has already been released, lockDate will be nil. If + so, just try again. */ + if (!lockDate) + { + RELEASE(arp); + continue; + } when = [NSDate dateWithTimeIntervalSinceNow: 0.1]; - if ([when timeIntervalSinceDate: [_fileLock lockDate]] > 5.0) + if ([when timeIntervalSinceDate: lockDate] > 5.0) { [_fileLock breakLock]; }