@@ -36,8 +36,16 @@ public AdjustAttribution(string jsonString)
36
36
clickLabel = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyClickLabel ) ;
37
37
adid = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyAdid ) ;
38
38
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 ) ,
40
42
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
+ }
41
49
costCurrency = AdjustUtils . GetJsonString ( jsonNode , AdjustUtils . KeyCostCurrency ) ;
42
50
}
43
51
@@ -57,8 +65,16 @@ public AdjustAttribution(Dictionary<string, string> dicAttributionData)
57
65
clickLabel = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyClickLabel ) ;
58
66
adid = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyAdid ) ;
59
67
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 ) ,
61
71
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
+ }
62
78
costCurrency = AdjustUtils . TryGetValue ( dicAttributionData , AdjustUtils . KeyCostCurrency ) ;
63
79
}
64
80
}
0 commit comments