Skip to content

Conversation

fioan89
Copy link
Collaborator

@fioan89 fioan89 commented Oct 3, 2025

Replace !! operators with safe idiom takeIf/let chains. The non-null assertions were unsafe in concurrent scenarios where one thread could potentially modify the settings while another thread reads and makes non-null assertions.

Replace !! operators with safe idiom takeIf/let chains.
The non-null assertions were unsafe in concurrent scenarios where one
thread could potentially modify the settings while another thread
reads and makes non-null assertions.
Copy link
Member

@code-asher code-asher left a comment

Choose a reason for hiding this comment

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

love it

): WorkspaceAgent? {
val agents = workspace.latestBuild.resources.filter { it.agents != null }.flatMap { it.agents!! }
val agents = workspace.latestBuild.resources
.mapNotNull { it.agents }
Copy link
Member

Choose a reason for hiding this comment

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

ooo I did not know about mapNotNull, neat

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.

3 participants