mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
fix panic on negative counter value update
This commit is contained in:
parent
7014df051c
commit
3eca182ddf
@ -55,9 +55,10 @@ impl Response {
|
|||||||
control.update(
|
control.update(
|
||||||
form.widget.text().is_empty(),
|
form.widget.text().is_empty(),
|
||||||
size_limit.map(|limit| {
|
size_limit.map(|limit| {
|
||||||
limit
|
limit as isize
|
||||||
- (base.to_string_partial(UriHideFlags::QUERY).len()
|
- ((base.to_string_partial(UriHideFlags::QUERY).len()
|
||||||
+ Uri::escape_string(&form.widget.text(), None, false).len())
|
+ Uri::escape_string(&form.widget.text(), None, false).len())
|
||||||
|
as isize)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ impl Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<isize>) {
|
||||||
// Update children components
|
// Update children components
|
||||||
self.counter.update(is_empty, bytes_left);
|
self.counter.update(is_empty, bytes_left);
|
||||||
self.send.update(match bytes_left {
|
self.send.update(match bytes_left {
|
||||||
|
@ -23,7 +23,7 @@ impl Counter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<isize>) {
|
||||||
self.widget.update(is_empty, bytes_left);
|
self.widget.update(is_empty, bytes_left);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ impl Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
pub fn update(&self, is_empty: bool, bytes_left: Option<usize>) {
|
pub fn update(&self, is_empty: bool, bytes_left: Option<isize>) {
|
||||||
match bytes_left {
|
match bytes_left {
|
||||||
Some(value) => {
|
Some(value) => {
|
||||||
// Update color on chars left reached
|
// Update color on chars left reached
|
||||||
|
Loading…
x
Reference in New Issue
Block a user