From ade0036037eb53c1649b92df8b8a6e9488de17b2 Mon Sep 17 00:00:00 2001 From: rfm Date: Fri, 8 Jun 2012 11:08:27 +0000 Subject: [PATCH] don't return an object if there is no error git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35186 72102866-910b-0410-8b05-ffd578937521 --- Source/Additions/NSError+GNUstepBase.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Additions/NSError+GNUstepBase.m b/Source/Additions/NSError+GNUstepBase.m index 5b563ef76..1bec6831d 100644 --- a/Source/Additions/NSError+GNUstepBase.m +++ b/Source/Additions/NSError+GNUstepBase.m @@ -100,8 +100,8 @@ strerror_r(int eno, char *buf, int len) #endif #endif -/* - * Returns an NSError instance encapsulating the last system error. +/* Returns an NSError instance encapsulating the last system error, + * or nil if the last system call did not result in an error. * The user info dictionary of this object will be mutable, so that * additional information can be placed in it by higher level code. */ @@ -114,6 +114,10 @@ strerror_r(int eno, char *buf, int len) #else eno = errno; #endif + if (0 == eno) + { + return nil; + } return [self _systemError: eno]; }