Fix exception handling and operator precedence bugs (#295)

- Add return statement in catch(...) block to prevent fallthrough
- Fix operator precedence in GetState() to capture Call() return value

Fixes #201, #202

Co-authored-by: Levi Neely <lkn@darkstar.example.net>
This commit is contained in:
Levi Neely 2026-03-03 11:25:25 +01:00 committed by GitHub
parent c0cc893cc7
commit 175a46a109
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 1 deletions

View File

@ -214,6 +214,7 @@ int main(int argc, char **argv) {
return 1;
} catch (...) {
std::cerr << "Exception of unknown type!" << std::endl;
return 1;
}
if (daemon) {

View File

@ -135,7 +135,7 @@ int RpcClient::GetState(pCloud_FileState *state, char *path) {
size_t errm_size = 0;
int rep = 0;
if ((rep = this->Call(4, path, &errm, &errm_size) == 0)) {
if ((rep = this->Call(4, path, &errm, &errm_size)) == 0) {
pdbg_logf(D_NOTICE, "rpc_get_state responese rep[%d] path[%s]", rep, path);
if (errm) {
pdbg_logf(D_NOTICE, "The error is %s", errm);