@@ -36,8 +36,16 @@ public AdjustAttribution(string jsonString)
3636 clickLabel = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyClickLabel ) ;
3737 adid = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyAdid ) ;
3838 costType = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyCostType ) ;
39- costAmount = double . Parse ( AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyCostAmount ) ,
39+ try
40+ {
41+ costAmount = double . Parse ( AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyCostAmount ) ,
4042 System . Globalization . CultureInfo . InvariantCulture ) ;
43+ }
44+ catch ( Exception )
45+ {
46+ // attribution response doesn't contain cost amount attached
47+ // value will default to null
48+ }
4149 costCurrency = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyCostCurrency ) ;
4250 }
4351
@@ -57,8 +65,16 @@ public AdjustAttribution(Dictionary<string, string> dicAttributionData)
5765 clickLabel = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyClickLabel ) ;
5866 adid = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyAdid ) ;
5967 costType = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyCostType ) ;
60- costAmount = double . Parse ( AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyCostAmount ) ,
68+ try
69+ {
70+ costAmount = double . Parse ( AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyCostAmount ) ,
6171 System . Globalization . CultureInfo . InvariantCulture ) ;
72+ }
73+ catch ( Exception )
74+ {
75+ // attribution response doesn't contain cost amount attached
76+ // value will default to null
77+ }
6278 costCurrency = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyCostCurrency ) ;
6379 }
6480 }
0 commit comments