Skip to content

Commit

Permalink
[fix] 修复了field形式填map的时候多级标题会报空引用的问题。 (#130)
Browse files Browse the repository at this point in the history
Co-authored-by: lintianbao <lintianbao@thedream.cc>
  • Loading branch information
kteong1012 and lintianbao authored Apr 17, 2024
1 parent a58d93a commit 6ac5543
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Luban.DataLoader.Builtin/DataVisitors/SheetDataCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private List<DType> CreateBeanFields(DefBean bean, RowColumnSheet sheet, TitleRo
}
catch (Exception e)
{
var dce = new DataCreateException(e, $"Sheet:{sheet.SheetName} 字段:{fname} 位置:{field.Location}");
var dce = new DataCreateException(e, $"Sheet:{sheet.SheetName} 字段:{fname} 位置:{field.Location}");
dce.Push(bean, f);
throw dce;
}
Expand Down Expand Up @@ -476,12 +476,20 @@ public DType Accept(TMap type, RowColumnSheet sheet, TitleRow row)
foreach (var e in row.Fields)
{
var keyData = type.KeyType.Apply(StringDataCreator.Ins, e.Key);
if (RowColumnSheet.IsBlankRow(e.Value.Row, e.Value.SelfTitle.FromIndex, e.Value.SelfTitle.ToIndex))
if (e.Value.Row != null)
{
continue;
if (RowColumnSheet.IsBlankRow(e.Value.Row, e.Value.SelfTitle.FromIndex, e.Value.SelfTitle.ToIndex))
{
continue;
}
var valueData = type.ValueType.Apply(ExcelStreamDataCreator.Ins, e.Value.AsStream(""));
datas.Add(keyData, valueData);
}
else
{
var valueData = type.ValueType.Apply(this, sheet, e.Value);
datas.Add(keyData, valueData);
}
var valueData = type.ValueType.Apply(ExcelStreamDataCreator.Ins, e.Value.AsStream(""));
datas.Add(keyData, valueData);
}
return new DMap(type, datas);
}
Expand Down

0 comments on commit 6ac5543

Please sign in to comment.