Skip to content
This repository was archived by the owner on Jul 6, 2022. It is now read-only.

Commit d4f679e

Browse files
author
Jérémie Bertrand
committed
🚨 sonarlint warning - merge if statements
1 parent b09fb88 commit d4f679e

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/ScriptCs.ComponentModel.Composition/ScriptCsCatalog.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -335,30 +335,27 @@ protected override void Dispose(bool disposing)
335335
{
336336
try
337337
{
338-
if (disposing)
338+
if (disposing && !_isDisposed)
339339
{
340-
if (!_isDisposed)
341-
{
342-
AssemblyCatalog catalogs = null;
340+
AssemblyCatalog catalogs = null;
343341

344-
try
342+
try
343+
{
344+
lock (_thisLock)
345345
{
346-
lock (_thisLock)
346+
if (!_isDisposed)
347347
{
348-
if (!_isDisposed)
349-
{
350-
catalogs = _catalog;
351-
_catalog = null;
352-
_isDisposed = true;
353-
}
348+
catalogs = _catalog;
349+
_catalog = null;
350+
_isDisposed = true;
354351
}
355352
}
356-
finally
353+
}
354+
finally
355+
{
356+
if (catalogs != null)
357357
{
358-
if (catalogs != null)
359-
{
360-
catalogs.Dispose();
361-
}
358+
catalogs.Dispose();
362359
}
363360
}
364361
}

0 commit comments

Comments
 (0)