From 804ad341cde64b4912d4c456e1ab1697cc77f6ee Mon Sep 17 00:00:00 2001 From: alexm Date: Tue, 1 Oct 2002 00:24:04 +0000 Subject: [PATCH] Handle lockDate being nil. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14612 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 4 ++++ Source/NSUserDefaults.m | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) 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]; }