[NT-0] fix: Removing an asset collection assert #841
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Issue
A CSP client app developer recently reported a crash when attempting to enter a space. Turns out it was due to there being an asset collection/prototype in the space that did not conform to the types CSP expects, which caused CSP to fire an assert.
The Fix
To fix, we follow the same pattern as with Asset.cpp and emit an
Errorlog message instead of an assert (see here).The Tests
Initial test implementation to validate type parsing for the DTO came in here. Then refined that to use the test matrix approach here.
Bonus
The tests highlighted that CSP was (not unreasonanbly) assuming certain fields would always exist on prototype DTOs. Problem was if they didn't exist, it would lead to an uncaught exception. To fix, we now follow the same pattern for all prototype DTO fields, first testing for then existence, and only then retrieving their value.
Added bonus, whilst in the area I elected to nuke the
CharityDTO type CSP was checking for, as it was agreed we should remove it in a recent CSP working group session.Both bonus changes can be seen here.