Instead of doing funny stuff, just assume 0 is unexpected

This commit is contained in:
Adam Demasi 2024-10-14 01:38:31 +10:30
parent c15edda0e5
commit 5fd4dff7b8
No known key found for this signature in database
GPG key ID: 5D3B26B3D58C7D91

View file

@ -5,18 +5,12 @@
PLUGIN_METHOD(MessageForHresult) { PLUGIN_METHOD(MessageForHresult) {
PLUGIN_INIT(); PLUGIN_INIT();
LPWSTR str; HRESULT hr = popint();
popstring(str); if (hr == 0) {
pushstring(L"Unknown error");
// Handle non-numeric inputs return;
for (int i = 0; str[i] != L'\0'; i++) {
if (str[i] < L'0' || str[i] > L'9') {
pushstring(L"Unknown error");
return;
}
} }
HRESULT hr = nsishelper_str_to_ptr(str);
LPWSTR message = GetMessageForHresult(hr); LPWSTR message = GetMessageForHresult(hr);
pushstring(message); pushstring(message);
LocalFree(message); LocalFree(message);