Skip to content

Commit

Permalink
fix getChannel when it is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jun 22, 2023
1 parent 99a2730 commit 0dee01d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/tauri/mobile/ios-api/Sources/Tauri/Invoke.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ let CHANNEL_PREFIX = "__CHANNEL__:"

public func getChannel(_ key: String) -> Channel? {
let channelDef = getString(key, "")
guard let channelId = UInt64(channelDef.components(separatedBy: CHANNEL_PREFIX)[1]) else {
let components = channelDef.components(separatedBy: CHANNEL_PREFIX)
if components.count < 2 {
return nil
}
guard let channelId = UInt64(components[1]) else {
return nil
}
return Channel(
Expand Down

0 comments on commit 0dee01d

Please sign in to comment.