Slight change to Cmp() function to better handle null-pointers.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@697 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
64a5de3bf7
commit
b4fe86b884
1 changed files with 3 additions and 0 deletions
|
|
@ -186,6 +186,9 @@ DohCmp(const DOH *obj1, const DOH *obj2) {
|
||||||
b1 = (DohBase *) obj1;
|
b1 = (DohBase *) obj1;
|
||||||
b2 = (DohBase *) obj2;
|
b2 = (DohBase *) obj2;
|
||||||
if ((!DohCheck(b1)) || (!DohCheck(b2))) {
|
if ((!DohCheck(b1)) || (!DohCheck(b2))) {
|
||||||
|
if ((b1 == 0) && (b2 == 0)) return 0;
|
||||||
|
if (b1 && !b2) return 1;
|
||||||
|
if (!b1 && b2) return -1;
|
||||||
return strcmp((char *) DohData(b1),(char *) DohData(b2));
|
return strcmp((char *) DohData(b1),(char *) DohData(b2));
|
||||||
}
|
}
|
||||||
b1info = dohtypes[b1->type];
|
b1info = dohtypes[b1->type];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue