diff --git a/src/MiniExcel/Utils/CustomPropertyHelper.cs b/src/MiniExcel/Utils/CustomPropertyHelper.cs index 8945bc3ec8d51c60ff608fc6988160aec078d7aa..1bf6e0b3431b70f737e9e3b32e00eb871563aa83 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);