Currently, SettableSurface is allowed to return null when accessed via indexer, in the case where there is no terrain object at the corresponding position in the map it exposes. This is inviable, because SadConsole conducts no null checks during rendering; and as such this situation will cause a null reference exception as soon as rendering occurs.
Proposed Solution
I propose that RogulikeMap.TerrainView be implemented to return a fully transparent appearance for locations where there are no terrain, and thus guarantee its return value is non-nullable. Further, I propose that SettableSurface be modified to use TerrainView to obtain its values.
Issue
Currently,
SettableSurface
is allowed to returnnull
when accessed via indexer, in the case where there is no terrain object at the corresponding position in the map it exposes. This is inviable, because SadConsole conducts no null checks during rendering; and as such this situation will cause a null reference exception as soon as rendering occurs.Proposed Solution
I propose that
RogulikeMap.TerrainView
be implemented to return a fully transparent appearance for locations where there are no terrain, and thus guarantee its return value is non-nullable. Further, I propose thatSettableSurface
be modified to useTerrainView
to obtain its values.