Browse Source

!228 cn.hutool.core.collection.CollUtil#addAll(java.util.Collection<T>, java.lang.Iterable<T>) 判断空指针

Merge pull request !228 from jiangzeyin/v5-dev
Looly 5 years ago
parent
commit
0596112cf6
1 changed files with 3 additions and 0 deletions
  1. 3 0
      hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java

+ 3 - 0
hutool-core/src/main/java/cn/hutool/core/collection/CollUtil.java

@@ -2108,6 +2108,9 @@ public class CollUtil {
 	 * @return 原集合
 	 */
 	public static <T> Collection<T> addAll(Collection<T> collection, Iterable<T> iterable) {
+		if (iterable == null) {
+			return collection;
+		}
 		return addAll(collection, iterable.iterator());
 	}