Skip to content

Commit b165f8a

Browse files
authored
NullReference on object[] (item) #217 (#218)
(cherry picked from commit 703ce73)
1 parent c07b954 commit b165f8a

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

ClosedXML.Report/Options/GroupTag.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public override void Execute(ProcessingContext context)
101101

102102
private bool DisableGrandTotal => List.HasTag("disablegrandtotal") || !List.GetAll<SummaryFuncTag>().Any();
103103

104-
private void Process(ProcessingContext context, GroupTag[] groups, bool summaryAbove, SummaryFuncTag[] summaries , bool disableGrandTotal)
104+
private void Process(ProcessingContext context, GroupTag[] groups, bool summaryAbove, SummaryFuncTag[] summaries, bool disableGrandTotal)
105105
{
106106
var root = context.Range;
107107
var groupRow = root.LastRow();

ClosedXML.Report/Utils/TypeExtensions.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ public static Type GetItemType(this IEnumerable sourceList)
6161

6262
public static bool IsAllItemsAssignableFrom(this IEnumerable list, Type type)
6363
{
64-
return list.Cast<object>().All(item => item.GetType().IsAssignableFrom(type));
64+
return list.Cast<object>().All(item =>
65+
type.IsValueType
66+
? item != null && item.GetType().IsAssignableFrom(type)
67+
: item == null || item.GetType().IsAssignableFrom(type));
6568
}
6669

6770
internal static bool IsNumeric(this Type type)

0 commit comments

Comments
 (0)