Fix potential use after dealloc

This commit is contained in:
rfm 2024-06-19 11:08:58 +01:00
parent 6f94c90d98
commit da1a69e4bd

View file

@ -206,19 +206,19 @@ static BOOL initialized = NO;
ascending: (BOOL) ascending
comparator: (NSComparator) cmptr
{
if ([self init])
if ((self = [self init]) != nil)
{
if (key == nil)
{
[NSException raise: NSInvalidArgumentException
format: @"%@", _(@"Passed nil key when initializing "
@"an NSSortDescriptor.")];
format: @"%@", _(@"Passed nil key when initializing"
@" an NSSortDescriptor.")];
}
if (cmptr == NULL)
{
[NSException raise: NSInvalidArgumentException
format: @"%@", _(@"Passed NULL comparator when initializing "
@"an NSSortDescriptor.")];
format: @"%@", _(@"Passed NULL comparator when"
@" initializing an NSSortDescriptor.")];
}
ASSIGN(_key, key);
@ -237,7 +237,7 @@ static BOOL initialized = NO;
ascending: (BOOL) ascending
selector: (SEL) selector
{
if ([self init])
if ((self = [self init]) != nil)
{
if (key == nil)
{