From 62806c3aacd1ec6f8723d25bad3354334e12d0a3 Mon Sep 17 00:00:00 2001 From: wulaohu Date: Thu, 7 Sep 2023 10:31:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84=E5=AE=9E=E4=BD=93=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=98=AF=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=9E=8B=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9C=89=E8=84=8F=E6=95=B0=E6=8D=AE=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E8=A7=A3=E9=87=8A=E5=87=BA=E6=9D=A5=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BF=A1=E6=81=AF=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MiniExcel/Utils/CustomPropertyHelper.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/MiniExcel/Utils/CustomPropertyHelper.cs b/src/MiniExcel/Utils/CustomPropertyHelper.cs index 8945bc3..1bf6e0b 100644 --- a/src/MiniExcel/Utils/CustomPropertyHelper.cs +++ b/src/MiniExcel/Utils/CustomPropertyHelper.cs @@ -135,6 +135,9 @@ internal static List GetExcelCustomPropertyInfos(Type type, str internal static string DescriptionAttr(Type type, object source) { FieldInfo fi = type.GetField(source.ToString()); + //For some database dirty data, there may be no way to change to the correct enumeration, will return NULL + if (fi == null) + return source.ToString(); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); -- Gitee