cli-config: Ovf in ws port calculation

This commit is contained in:
Trent Nelson 2021-02-16 13:56:36 -07:00 committed by Trent Nelson
parent 193e370186
commit 66b4124a68
2 changed files with 2 additions and 2 deletions

View File

@ -75,7 +75,8 @@ impl Config {
.set_scheme(if is_secure { "wss" } else { "ws" }) .set_scheme(if is_secure { "wss" } else { "ws" })
.expect("unable to set scheme"); .expect("unable to set scheme");
if let Some(port) = json_rpc_url.port() { if let Some(port) = json_rpc_url.port() {
ws_url.set_port(Some(port + 1)).expect("unable to set port"); let port = port.checked_add(1).expect("port out of range");
ws_url.set_port(Some(port)).expect("unable to set port");
} }
ws_url.to_string() ws_url.to_string()
} }

View File

@ -1,4 +1,3 @@
#![allow(clippy::integer_arithmetic)]
#[macro_use] #[macro_use]
extern crate lazy_static; extern crate lazy_static;