From 1d10e758f4664f1cfb6984a8a50cdd6f0c6057a7 Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 8 Jun 2022 16:02:11 +0800 Subject: [PATCH] fix --- CHANGELOG.md | 3 ++- .../src/main/java/cn/hutool/core/collection/IterUtil.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2decfb5a..55a20bbe5 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,12 @@ ------------------------------------------------------------------------------------------------------------- -# 5.8.3.M1 (2022-05-30) +# 5.8.3.M1 (2022-06-08) ### 🐣新特性 * 【extra 】 mail增加writeTimeout参数支持(issue#2355@Github) * 【core 】 FileTypeUtil增加pptx扩展名支持(issue#I5A0GO@Gitee) +* 【core 】 IterUtil.get增加判空(issue#I5B12A@Gitee) ### 🐞Bug修复 * 【core 】 修复NumberUtil.isXXX空判断错误(issue#2356@Github) diff --git a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java index dd0445e65..b7db3b13f 100755 --- a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java +++ b/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java @@ -553,6 +553,9 @@ public class IterUtil { * @since 5.8.0 */ public static E get(final Iterator iterator, int index) throws IndexOutOfBoundsException { + if(null == iterator){ + return null; + } Assert.isTrue(index >= 0, "[index] must be >= 0"); while (iterator.hasNext()) { index--;