From 2f7b69d6d4cf18ca9ca04d9a44aaa6871ce51160 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 7 Sep 2022 00:40:26 +0200 Subject: Improve error handling. --- c/episodelistview.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'c/episodelistview.cpp') diff --git a/c/episodelistview.cpp b/c/episodelistview.cpp index b683114..db67ca9 100644 --- a/c/episodelistview.cpp +++ b/c/episodelistview.cpp @@ -162,7 +162,8 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam) const ElvDataA& e = parent.fvElv.At(nm->nmcd.lItemlParam-1); if (!e.bWatched) { extern HFONT g_hfBold; - Require(SelectObject(nm->nmcd.hdc, g_hfBold)); + if (!SelectObject(nm->nmcd.hdc, g_hfBold)) + throw Err(WINDOWS, L"Bold font could not be selected: %s"); return CDRF_NEWFONT; } break; @@ -183,8 +184,9 @@ LRESULT EpisodeListView::HandleNotify(const LPARAM lParam) case NM_RCLICK: { const DWORD pos = GetMessagePos(); - Require(TrackPopupMenu(parent.hMenuPopup, TPM_RIGHTBUTTON, - LOWORD(pos), HIWORD(pos), 0, parent.hWnd, nullptr)); + if (!TrackPopupMenu(parent.hMenuPopup, TPM_RIGHTBUTTON, + LOWORD(pos), HIWORD(pos), 0, parent.hWnd, nullptr)) + throw Err(WINDOWS, L"Context menu could not be opened: %s"); return 0; } -- cgit v1.2.3