fix segfault when no threads are configuredb ... should use main thread.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/performance/trunk@36752 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-06-25 09:05:00 +00:00
parent b987200256
commit 4782d743ed

View file

@ -145,8 +145,13 @@ best(NSMutableArray *a)
GSIOThread *t;
[poolLock lock];
if (0 == maxThreads)
{
[poolLock unlock];
return [NSThread mainThread];
}
t = best(threads);
if (t->count > 0 && [threads count] < maxThreads)
if (nil == t || (t->count > 0 && [threads count] < maxThreads))
{
t = [GSIOThread new];
[threads addObject: t];