Skip to content

Commit 3cebcae

Browse files
committed
Refatorada lógica de limpeza de certificado para checar existência de certificado e configuração de cache
1 parent ed9412a commit 3cebcae

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

MDFe.Utils/Configuracoes/MDFeConfiguracao.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,15 @@ public void Dispose()
190190

191191
private void LimparCertificado()
192192
{
193-
var naoDeveManterCertificadoEmCache =
194-
!ConfiguracaoCertificado.ManterDadosEmCache && _certificado != null;
193+
var deveManterCertificadoEmCache = _certificado == null ||
194+
ConfiguracaoCertificado == null ||
195+
ConfiguracaoCertificado.ManterDadosEmCache;
195196

196-
if (naoDeveManterCertificadoEmCache)
197-
{
198-
_certificado.Reset();
199-
_certificado = null;
200-
}
197+
if (deveManterCertificadoEmCache)
198+
return;
199+
200+
_certificado.Reset();
201+
_certificado = null;
201202
}
202203
}
203204
}

0 commit comments

Comments
 (0)