解决选择设备时点击取消,弹窗提示异常的问题

This commit is contained in:
yangjiaxuan 2024-09-07 17:17:52 +08:00
parent 5440f484be
commit 14a82589ca
2 changed files with 2 additions and 1 deletions

View File

@ -262,7 +262,7 @@ HGResult DeviceUser::Open()
{
HGChar errInfo[256];
HGResult ret = HGSane_OpenSelectedDevice(m_source, m_wnd, &m_saneDev, errInfo, 256);
if (HGBASE_ERR_OK != ret)
if (HGBASE_ERR_OK != ret && strlen(errInfo) != 0)
{
QMessageBox::information(m_wnd, tr("Prompt"), errInfo);
}

View File

@ -558,6 +558,7 @@ HGResult HGSaneSourceImpl::OpenSelectedDevice(HGWindow parent, class HGSaneDevic
int id = choose_scanner(devs);
if (-1 == id)
{
memset(errInfo, 0, sizeof(errInfo));
return HGSANE_ERR_FAIL;
}