修复map类型可能panic问题

This commit is contained in:
白茶清欢 2023-08-27 14:40:13 +08:00
parent 8308761f72
commit 2886126ae7

3
map.go
View File

@ -31,6 +31,9 @@ func EasyMap(mapData interface{}) Map {
// //
// Date : 15:06 2023/8/10 // Date : 15:06 2023/8/10
func EasyMapWithError(mapData interface{}) (Map, error) { func EasyMapWithError(mapData interface{}) (Map, error) {
if nil == mapData {
return easymap.NewNormal(true), nil
}
m := easymap.NewNormal(true) m := easymap.NewNormal(true)
reflectType := reflect.TypeOf(mapData) reflectType := reflect.TypeOf(mapData)
if reflectType.Kind() != reflect.Map { if reflectType.Kind() != reflect.Map {