Skip to content

Fix terminal cleanup bounds checks - #7

Open
BlackSquarre wants to merge 1 commit into
op06072:mainfrom
BlackSquarre:fix-terminal-cleanup-bounds
Open

Fix terminal cleanup bounds checks#7
BlackSquarre wants to merge 1 commit into
op06072:mainfrom
BlackSquarre:fix-terminal-cleanup-bounds

Conversation

@BlackSquarre

Copy link
Copy Markdown

Summary

Fixes a crash when quitting NeoAsitop on layouts where the rendered tbox tree has fewer child items than fin(scr:) assumes.

The cleanup code previously indexed fixed positions such as:

  • scr.items[0]
  • scr.items[1]
  • scr.items[0].items[2].items[0]
  • loops over 0...2 / 0...1

On some machines/layouts, especially fanless configurations, those arrays can be shorter, causing:

Swift/ContiguousArrayBuffer.swift: Fatal error: Index out of range
Neoasitop.fin(scr:)

This change uses actual indices and guards nested fan cleanup before indexing.

Verification

Tested on:

  • MacBookAir10,1
  • Apple M1
  • macOS 15.7.7

Commands/tests run:

DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer" \
xcodebuild -project socpowerbuddy_swift.xcodeproj \
  -scheme socpowerbuddy_swift \
  -configuration Release \
  MACOSX_DEPLOYMENT_TARGET=15.0 \
  build

Result:

** BUILD SUCCEEDED **

Also smoke-tested the TUI by launching NeoAsitop in a terminal-sized pty and pressing q.

Result:

Good Bye!

No Fatal error and no lingering process.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
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.

1 participant