NickCraver / StackExchange.Exceptional

Error handler used for the Stack Exchange network
https://nickcraver.com/StackExchange.Exceptional/
Apache License 2.0
860 stars 170 forks source link

Fixes null reference exceptions #93

Closed StefanKert closed 6 years ago

StefanKert commented 6 years ago

This PR fixes two issues that occur if you add different settings:

  1. When trying to replace values in the Form Collection of an Error, a NullReferenceException occures if the request has no FormContentType. Since it makes no sense to override values that do not exist and especially since we shouldn´t use Form at all if the Request has no FormContentType we only should replace this values for requests with FormContentType

  2. While I was testing the new JSON settings implementation I found an issue that occurred when adding IgnoreSettings (Regex or Types). When creating the Settings object and in further consequence the IgnoreSettings object, the two Lists that are properties of this class are not instantiated. This lead to a NullReferenceException when trying to fill this Lists on Deserialization.

Both errors are occuring in StackExchange.Exceptional and in StackExchange.Exceptional.AspNetCore because they are located in StackExchange.Exceptional.Shared.

NickCraver commented 6 years ago

Resolve conflicts and merging in, thank you!