Fixed a potential NullReferenceException (though I'm thinking about phasing out the method it's happening in entirely)

git-svn-id: file:///srv/devel/repo-conversion/nusu@335 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2019-02-08 18:27:15 +00:00
parent 8cc16143de
commit 207a17712e

View File

@ -395,7 +395,10 @@ namespace Nuclex.Support.Threading {
public void ThrowIfBackgroundOperationCancelled() { public void ThrowIfBackgroundOperationCancelled() {
IRunner currentRunner = this.currentRunner; IRunner currentRunner = this.currentRunner;
if(currentRunner != null) { if(currentRunner != null) {
currentRunner.CancellationTokenSource.Token.ThrowIfCancellationRequested(); CancellationTokenSource source = currentRunner.CancellationTokenSource;
if(source != null) {
source.Token.ThrowIfCancellationRequested();
}
} }
} }