Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(console): avoid crash when accessing selected item #570

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

Rustin170506
Copy link
Collaborator

@Rustin170506 Rustin170506 commented Jul 8, 2024

We should check the length before using the index to access it.

close #565

Test locally:

Screen.Recording.2024-07-08.at.10.19.12.PM.mov

But it is difficult to view it, you can try it by following the steps from the issue.

Copy link
Collaborator

@hds hds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can avoid that extra level of indentation one way or another.

tokio-console/src/view/table.rs Outdated Show resolved Hide resolved
tokio-console/src/view/mod.rs Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔢 Self-check (PR reviewed by myself and ready for feedback.)

We should check the length before using the index to
access it.
Copy link
Member

@hawkw hawkw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks good to me!

@hawkw hawkw enabled auto-merge (squash) July 22, 2024 15:17
@Rustin170506
Copy link
Collaborator Author

@hds Need your approval to merge it. Could you please take another look? Thank you!

Copy link
Collaborator

@hds hds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you!

@hawkw hawkw merged commit 9205e15 into tokio-rs:main Jul 24, 2024
17 checks passed
@github-actions github-actions bot mentioned this pull request Jul 24, 2024
@Rustin170506 Rustin170506 deleted the rustin-patch-crash branch July 24, 2024 08:26
@Rustin170506
Copy link
Collaborator Author

Thanks for your review! 💚 💙 💜 💛 ❤️

hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.2.0 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
</blockquote>

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.2.0 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Fixed

- Remove unused `AggregatorHandle` and fix other lints ([#578](#578)) ([c442063](c442063))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.1.12 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Fixed

- Remove unused `AggregatorHandle` and fix other lints ([#578](#578)) ([c442063](c442063))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.1.12 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](https://github.com/tokio-rs/console/commit/5f6faa22d944735c2b8c312cac03b35a4ab228ef))<br />This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Fixed

- Remove unused `AggregatorHandle` and fix other lints ([#578](#578)) ([c442063](c442063))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.1.12 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](5f6faa2))
This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](5f6faa2))
This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Fixed

- Remove unused `AggregatorHandle` and fix other lints ([#578](#578)) ([c442063](c442063))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))
hds pushed a commit that referenced this pull request Jul 29, 2024
…onsole-v0.1.12 (#576)

## 🤖 New release
* `tokio-console`: 0.1.11 -> 0.1.12
* `console-api`: 0.7.0 -> 0.8.0
* `console-subscriber`: 0.3.0 -> 0.4.0

## `tokio-console`

## 0.1.12 - (2024-07-29)

### Fixed

- Handle Windows path correctly ([#555](#555)) ([6ad0def](6ad0def))
- Avoid crash when accessing selected item ([#570](#570)) ([9205e15](9205e15))

### Updated

- Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-api`

## 0.8.0 - (2024-07-29)

### <a id = "0.8.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](5f6faa2))
This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Updated

- [**breaking**](#0.8.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

## `console-subscriber`

## 0.4.0 - (2024-07-29)

### <a id = "0.4.0-breaking"></a>Breaking Changes
- **Upgrade tonic to 0.12 ([#571](#571 ([5f6faa2](5f6faa2))
This is a breaking change for users of `console-api` and
`console-subscriber`, as it changes the public `tonic`, `prost` and
`prost-types` dependency to a semver-incompatible version. This breaks
compatibility with `tonic` 0.11.x as well as `prost`/`prost-types`
0.12.x.

### Added

- Add `TOKIO_CONSOLE_BUFFER_CAPACITY`  env variable ([#568](#568)) ([a6cf14b](a6cf14b))

### Fixed

- Remove unused `AggregatorHandle` and fix other lints ([#578](#578)) ([c442063](c442063))

### Updated

- [**breaking**](#0.4.0-breaking) Upgrade tonic to 0.12 ([#571](#571)) ([5f6faa2](5f6faa2))

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when selecting a task that no longer exists
3 participants