Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crash in getStoredCookies, calling fromJson with null #34

Closed
sgehrman opened this issue May 12, 2020 · 0 comments
Closed

crash in getStoredCookies, calling fromJson with null #34

sgehrman opened this issue May 12, 2020 · 0 comments
Assignees

Comments

@sgehrman
Copy link

sgehrman commented May 12, 2020

Exception has occurred.
NoSuchMethodError (NoSuchMethodError: The getter 'length' was called on null.
Receiver: null
Tried calling: length)

static Future<Map<String, String>> getStoredCookies(String hostname) async {
    try {
      String hostnameHash = Common.hashStringSHA256(hostname);
      String cookiesJson = await Common.storageGet('cookies-$hostnameHash');


   // first launch cookiesJson is null, but you are calling fromJson below will null


      var cookies = Common.fromJson(cookiesJson);
      return Map<String, String>.from(cookies);
    } catch (e) {
      log.shout(
          "problem reading stored cookies. fallback with empty cookies $e");
      return Map<String, String>();
    }
  }
@jossef jossef self-assigned this May 15, 2020
@jossef jossef closed this as completed in 15f8c17 May 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants