mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
Raise exception if smeone tries to initialise a date with NaN
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26865 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
132c0a285d
commit
7da55c5e34
3 changed files with 17 additions and 0 deletions
|
@ -46,6 +46,8 @@
|
|||
|
||||
#include "GSPrivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/* These constants seem to be what MacOS-X uses */
|
||||
#define DISTANT_FUTURE 63113990400.0
|
||||
#define DISTANT_PAST -63113817600.0
|
||||
|
@ -1354,6 +1356,12 @@ otherTime(NSDate* other)
|
|||
|
||||
- (id) initWithTimeIntervalSinceReferenceDate: (NSTimeInterval)secs
|
||||
{
|
||||
if (isnan(secs))
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@-%@] interval is not a number",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
_seconds_since_ref = secs;
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue