Skip to content

Commit

Permalink
avoid application crash
Browse files Browse the repository at this point in the history
when userProperty was nil,to set the key & value,here will crash
  • Loading branch information
1989allen126 authored and leeway1208 committed Jun 19, 2022
1 parent 99180d1 commit 2e55f03
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Source/MqttDecodePublish.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ public class MqttDecodePublish: NSObject {
}
value = valRes.resStr
dataIndex = valRes.newOffset

//fixme:这里需要注意,直接强制解包会崩溃
if userProperty == nil {
userProperty = [:]
}

userProperty![key!] = value

Expand Down

0 comments on commit 2e55f03

Please sign in to comment.