fix (pre-emptive): Add null check in 'DisposeAll' fn
Bugs (fixed):
* The volsurface graph settings dialog crashes when you click OK/Apply
Note: This fix is 'pre-emptive' because I saw the bug while working on the
vs graph settings dialog. That feat will be added shortly in a subsequent
commit (I wanted to commit the fix first so the bug wouldn't be in the
official 'feat' revision/commit).
Cause: A null ref ex is thrown in DisposeAll, because the List of IDisposables
to dispose contains null items.
Another way to fix the bug would have been to make sure null items aren't
added to these Lists in the first place. However, that places the burden (to
check for null) on the callers' shoulders, and leaves open the potential for
this bug in every place where 'DisposeAll' is called.
This commit is contained in:
1 parent
a32e969b39
commit
c0289719e7
1 file changed
+1
-1
@@ -63,7 +63,7 @@ namespace Spark.Core.Disposables {
|
||||
return;
|
||||
}
|
||||
foreach (var d in source) {
|
||||
d.Dispose();
|
||||
d?.Dispose();
|
||||
}
|
||||
if (clear) {
|
||||
source.Clear();
|
||||
|
||||
Reference in new issue
Block a user