tester crashes on close if twain not initialized.

This commit is contained in:
soukoku
2014-06-26 06:50:48 -04:00
parent e639ca5429
commit f2e3196612

View File

@@ -40,6 +40,8 @@ namespace Tester.Winform
}
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (_twain != null)
{
if (e.CloseReason == CloseReason.UserClosing && _twain.State > 4)
{
@@ -49,6 +51,7 @@ namespace Tester.Winform
{
CleanupTwain();
}
}
base.OnFormClosing(e);
}
@@ -104,8 +107,6 @@ namespace Tester.Winform
}
private void CleanupTwain()
{
if (_twain != null)
{
if (_twain.State == 4)
{
@@ -122,7 +123,6 @@ namespace Tester.Winform
_twain.ForceStepDown(2);
}
}
}
#endregion