mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-03-25 09:25:50 +00:00
Fix array bounds checking in window parsing
- Add proper bounds checking in TerminalLauncher.swift when parsing AppleScript results - Add safe array access in WebRTCManager.swift for SDP line parsing - Add detailed error logging for debugging parsing failures - Prevents crashes when activity titles contain multiple words Fixes parsing errors like "Fixed CI build - added native dependencies" where AppleScript returns unexpected formats. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c2d9039e45
commit
3beb90a0fd
2 changed files with 12 additions and 4 deletions
|
|
@ -1394,7 +1394,9 @@ final class WebRTCManager: NSObject {
|
|||
|
||||
// Look for codecs in rtpmap before processing m=video line
|
||||
if line.contains("rtpmap") {
|
||||
let payloadType = line.components(separatedBy: " ")[0]
|
||||
let components = line.components(separatedBy: " ")
|
||||
guard !components.isEmpty else { continue }
|
||||
let payloadType = components[0]
|
||||
.replacingOccurrences(of: "a=rtpmap:", with: "")
|
||||
|
||||
if line.uppercased().contains("H264/90000") {
|
||||
|
|
|
|||
|
|
@ -464,9 +464,15 @@ final class TerminalLauncher {
|
|||
let components = result.split(separator: "|").map(String.init)
|
||||
logger.debug("Terminal.app components: \(components)")
|
||||
if components.count >= 2 {
|
||||
windowID = CGWindowID(components[0])
|
||||
tabReference = "tab id \(components[1]) of window id \(components[0])"
|
||||
logger.info("Terminal.app window ID: \(windowID ?? 0), tab reference: \(tabReference ?? "")")
|
||||
if let windowIDValue = UInt32(components[0]) {
|
||||
windowID = CGWindowID(windowIDValue)
|
||||
tabReference = "tab id \(components[1]) of window id \(components[0])"
|
||||
logger.info("Terminal.app window ID: \(windowID ?? 0), tab reference: \(tabReference ?? "")")
|
||||
} else {
|
||||
logger.warning("Failed to parse window ID from components[0]: '\(components[0])'")
|
||||
}
|
||||
} else {
|
||||
logger.warning("Unexpected AppleScript result format for Terminal.app. Expected 'windowID|tabID', got: '\(result)'. Components: \(components)")
|
||||
}
|
||||
} else if config.terminal == .iTerm2 {
|
||||
// iTerm2 returns window ID
|
||||
|
|
|
|||
Loading…
Reference in a new issue