Fixed bug where passing null to expiresDate failed

This commit is contained in:
Sense545 2019-01-25 17:55:18 +01:00
parent c34cdf55d5
commit 595625c853
2 changed files with 3 additions and 2 deletions

View File

@ -45,7 +45,8 @@ public class MyCookieManager implements MethodChannel.MethodCallHandler {
String value = (String) call.argument("value");
String domain = (String) call.argument("domain");
String path = (String) call.argument("path");
Long expiresDate = new Long((String) call.argument("expiresDate"));
String expiresDateString = (String) call.argument("expiresDate");
Long expiresDate = (expiresDateString != null ? new Long(expiresDateString) : null);
Integer maxAge = (Integer) call.argument("maxAge");
Boolean isSecure = (Boolean) call.argument("isSecure");
MyCookieManager.setCookie(url, name, value, domain, path, expiresDate, maxAge, isSecure, result);

View File

@ -1393,7 +1393,7 @@ class CookieManager {
args.putIfAbsent('value', () => value);
args.putIfAbsent('domain', () => domain);
args.putIfAbsent('path', () => path);
args.putIfAbsent('expiresDate', () => expiresDate.toString());
args.putIfAbsent('expiresDate', () => expiresDate?.toString());
args.putIfAbsent('maxAge', () => maxAge);
args.putIfAbsent('isSecure', () => isSecure);