When attempting to decode an incorrectly formatted String (i.e. '\7a1bb3}3b2b'), the existing rescue logic assigns a nil value to a payload variable that is then operated on as if it were a Hash
This can lead to the below error:
gems/store_model-2.1.1/lib/store_model/types/one.rb:93:in `block in deserialize_by_types': undefined method `key?' for nil:NilClass (NoMethodError)
Proposed Solution:
We should return nil (i.e. in the case of line 71) instead of allowing the above NoMethodError to happen
I'm happy to cut a PR for this once the issue is acknowledged and proposed solution agreed upon
The problematic code: https://github.com/DmitryTsepelev/store_model/blob/9a502a3fcee1dfeb31be12a0a20c416dc1afc8d4/lib/store_model/types/one.rb#L66-L67
The issue:
rescue
logic assigns anil
value to apayload
variable that is then operated on as if it were a HashProposed Solution:
I'm happy to cut a PR for this once the issue is acknowledged and proposed solution agreed upon