mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
Add some sanity checks to last modification.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16017 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e44583d14b
commit
cc1052c46e
1 changed files with 11 additions and 0 deletions
|
@ -794,9 +794,20 @@ compare(id elem1, id elem2, void* context)
|
|||
{
|
||||
NSComparisonResult (*imp)(id, SEL, id);
|
||||
|
||||
if (context == 0)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"compare null selector given"];
|
||||
|
||||
imp = (NSComparisonResult (*)(id, SEL, id))
|
||||
[elem1 methodForSelector: context];
|
||||
|
||||
if (imp == NULL)
|
||||
{
|
||||
[NSException raise: NSGenericException
|
||||
format: @"invalid selector passed to compare"];
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (*imp)(elem1, context, elem2);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue