diff --git a/src/Lumina/Excel/RowParser.cs b/src/Lumina/Excel/RowParser.cs index 5cc4a9e1..4e9c7a42 100644 --- a/src/Lumina/Excel/RowParser.cs +++ b/src/Lumina/Excel/RowParser.cs @@ -435,9 +435,14 @@ private byte GetBitPosition( byte flag ) /// /// The column index to lookup /// The type to store the read data in - /// The read data contained in the provided type + /// The read data contained in the provided type, or the default value of the type if the column given is out of bounds public T? ReadColumn< T >( int column ) { + if( column >= _sheet.ColumnCount ) + { + return default; + } + var col = _sheet.Columns[ column ]; Stream.Position = _rowOffset + col.Offset; @@ -453,9 +458,14 @@ private byte GetBitPosition( byte flag ) /// but this can be useful when you don't need to care about it's type and can use it as is - e.g. ToString and so on /// /// The column index to read from - /// An object containing the data from the row. - public object ReadColumnRaw( int column ) + /// An object containing the data from the row, or null if the column given is out of bounds + public object? ReadColumnRaw( int column ) { + if( column >= _sheet.ColumnCount ) + { + return null; + } + var col = _sheet.Columns[ column ]; Stream.Position = _rowOffset + col.Offset;