fix: selectEqu 的 pszSearch 判空条件写反 #51

Merged
gjm merged 1 commits from company-desktop-computer/fix/equlibdlg-search AGit into main 2026-10-25 11:07:19 +08:00
Collaborator

PR #50 去掉早退后,赋值条件写成 if (!pszSearch),正好相反:

  • pszSearch == NULL("插入设备"、selectSingleEqu(NULL, ...))
    把 NULL 赋给 CString,Debug 版触发 ASSERT(AfxIsValidString)
  • pszSearch != NULL(selectCustomValve 传入 "闸阀 DN100")
    预填的搜索词被清成空串,对话框打开后搜索框是空的

改为 if (pszSearch)。同时补上下面 CString sText(pszSearch) 的空判断,
pszSearch 为 NULL 时构造 CString 同样会 ASSERT。

保持用调用者传入的 pszSearch 判断设备子类型,而不是 dlg.m_sSearch:
后者在 DoModal 之后可能已被用户改成别的搜索词。

PR #50 去掉早退后,赋值条件写成 if (!pszSearch),正好相反: - pszSearch == NULL("插入设备"、selectSingleEqu(NULL, ...)) 把 NULL 赋给 CString,Debug 版触发 ASSERT(AfxIsValidString) - pszSearch != NULL(selectCustomValve 传入 "闸阀 DN100") 预填的搜索词被清成空串,对话框打开后搜索框是空的 改为 if (pszSearch)。同时补上下面 CString sText(pszSearch) 的空判断, pszSearch 为 NULL 时构造 CString 同样会 ASSERT。 保持用调用者传入的 pszSearch 判断设备子类型,而不是 dlg.m_sSearch: 后者在 DoModal 之后可能已被用户改成别的搜索词。
company-desktop added 1 commit 2026-10-25 11:05:32 +08:00
PR #50 去掉早退后,赋值条件写成 if (!pszSearch),正好相反:

- pszSearch == NULL("插入设备"、selectSingleEqu(NULL, ...))
  把 NULL 赋给 CString,Debug 版触发 ASSERT(AfxIsValidString)
- pszSearch != NULL(selectCustomValve 传入 "闸阀 DN100")
  预填的搜索词被清成空串,对话框打开后搜索框是空的

改为 if (pszSearch)。同时补上下面 CString sText(pszSearch) 的空判断,
pszSearch 为 NULL 时构造 CString 同样会 ASSERT。

保持用调用者传入的 pszSearch 判断设备子类型,而不是 dlg.m_sSearch:
后者在 DoModal 之后可能已被用户改成别的搜索词。
gjm merged commit 44f53dede4 into main 2026-10-25 11:07:19 +08:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: gjm/envi-code#51