From baac5d05d4abbbdb03620e424ced91aaa1b2bac7 Mon Sep 17 00:00:00 2001 From: Looly Date: Fri, 30 Aug 2024 10:49:08 +0800 Subject: [PATCH] =?UTF-8?q?GlobalSerializeMapping=E5=A2=9E=E5=8A=A0null?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 3 ++- .../java/cn/hutool/json/serialize/GlobalSerializeMapping.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0165b911f..7397e3183 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,11 @@ # 🚀Changelog ------------------------------------------------------------------------------------------------------------- -# 5.8.32(2024-08-29) +# 5.8.32(2024-08-30) ### 🐣新特性 * 【core 】 FileUtil.getTotalLines()支持CR换行符(issue#IAMZYR@Gitee) +* 【json 】 GlobalSerializeMapping增加null检查(issue#IANH1Y@Gitee) ### 🐞Bug修复 * 【http 】 修复getFileNameFromDisposition不符合规范问题(issue#IAKBPD@Gitee) diff --git a/hutool-json/src/main/java/cn/hutool/json/serialize/GlobalSerializeMapping.java b/hutool-json/src/main/java/cn/hutool/json/serialize/GlobalSerializeMapping.java index 64e21e37b..4e5984dbf 100644 --- a/hutool-json/src/main/java/cn/hutool/json/serialize/GlobalSerializeMapping.java +++ b/hutool-json/src/main/java/cn/hutool/json/serialize/GlobalSerializeMapping.java @@ -91,7 +91,7 @@ public class GlobalSerializeMapping { * @return 自定义的序列化器或者{@code null} */ public static JSONSerializer getSerializer(Type type){ - if(null == serializerMap) { + if(null == type || null == serializerMap) { return null; } return serializerMap.get(type); @@ -103,7 +103,7 @@ public class GlobalSerializeMapping { * @return 自定义的反序列化器或者{@code null} */ public static JSONDeserializer getDeserializer(Type type){ - if(null == deserializerMap) { + if(null == type || null == deserializerMap) { return null; } return deserializerMap.get(type);