diff options
author | Michael Bien <[email protected]> | 2011-02-09 18:16:23 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-02-09 18:16:23 +0100 |
commit | 08fe29a8696a2c77c1d24a637dfb54af2537afe7 (patch) | |
tree | e58076a8562630c88d52c3e07ba0bda9e612f1ed /src/com | |
parent | 4bf655ff4be8c92e6e9911555c04b9efbc4f0e15 (diff) |
fixed NPE in CLContext.release() which was indroduced in last commit.
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index b7ddb813..240f6d00 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -483,9 +483,11 @@ public class CLContext extends CLObject implements CLResource { private void release(Collection<? extends CLResource> resources) { // resources remove themselves when released, see above - CLResource[] array = resources.toArray(new CLResource[resources.size()]); - for (CLResource resource : array) { - resource.release(); + if(!resources.isEmpty()) { + CLResource[] array = resources.toArray(new CLResource[resources.size()]); + for (CLResource resource : array) { + resource.release(); + } } } @@ -501,7 +503,10 @@ public class CLContext extends CLObject implements CLResource { release(samplers); for (CLDevice device : getDevices()) { - release(queuesMap.get(device)); + Collection<CLCommandQueue> queues = queuesMap.get(device); + if(queues != null) { + release(queues); + } } }finally{ |