mirror of
https://github.com/transmission/transmission.git
synced 2026-02-14 23:19:34 +00:00
fix(web): exception from destructing undefined property (#8386)
(cherry picked from commit a628033637)
This commit is contained in:
@@ -21,6 +21,10 @@ export const RPC = {
|
||||
_UpSpeedLimited: 'speed_limit_up_enabled',
|
||||
};
|
||||
|
||||
function getResponseParams(response) {
|
||||
return response.result ?? response.error.data.result;
|
||||
}
|
||||
|
||||
export class Remote {
|
||||
_connection_alert = null;
|
||||
_session_id = '';
|
||||
@@ -163,8 +167,8 @@ export class Remote {
|
||||
o.params.ids = torrentIds;
|
||||
}
|
||||
this.sendRequest(o, (response) => {
|
||||
const { torrents, removed } = response.result;
|
||||
callback.call(context, torrents, removed);
|
||||
const res = getResponseParams(response);
|
||||
callback.call(context, res.torrents, res.removed);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -176,8 +180,8 @@ export class Remote {
|
||||
params: { path: dir },
|
||||
};
|
||||
this.sendRequest(o, (response) => {
|
||||
const { path, size_bytes } = response.result;
|
||||
callback.call(context, path, size_bytes);
|
||||
const res = getResponseParams(response);
|
||||
callback.call(context, res.path, res.size_bytes);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user