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

_TypeError: Null check operator used on a null value #1429

Open
sentry-io bot opened this issue Nov 20, 2024 · 1 comment
Open

_TypeError: Null check operator used on a null value #1429

sentry-io bot opened this issue Nov 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sentry-io
Copy link

sentry-io bot commented Nov 20, 2024

Sentry Issue: ANDROIDTV-6T

_TypeError: Null check operator used on a null value
  File "mosque_helpers_mixins.dart", line 136, in MosqueHelpersMixin.actualTimes.<fn>
  File "mosque_helpers_mixins.dart", line 136, in MosqueHelpersMixin.actualTimes
  File "mosque_helpers_mixins.dart", line 251, in MosqueHelpersMixin.useTomorrowTimes
  File "mosque_manager.dart", line 212, in MosqueManager.fetchMosque.<fn>
  File "Api.dart", in Api.getMosqueTimesStream
...
(25 additional frame(s) were not displayed)
@sentry-io sentry-io bot added the bug Something isn't working label Nov 20, 2024
@YassinNouh21
Copy link
Contributor

Issue Description

A TypeError is occurring in the actualTimes method within MosqueHelpersMixin. The error appears when trying to convert prayer time strings to TimeOfDay objects, specifically in the mapping operation:

return timesOfDay(date).map((e) => e.toTimeOfDay()!.toDate(date)).toList();

Root Cause

The error occurs due to several potential scenarios:

  1. Invalid time string formats in the prayer times data
  2. Null values in the time strings
  3. Failed parsing of time strings to TimeOfDay objects
  4. Non-null assertion operator (!) used on potentially null values

Reproduction Steps

Using Direct Implementation

final mosqueManager = MosqueManager();
mosqueManager.times = Times(
  fajr: "25:70",    // Invalid hours and minutes
  dhuhr: "invalid", // Non-numeric string
  asr: "",          // Empty string
  maghrib: "10:",   // Incomplete format
  isha: null,       // Null value
);

// This will trigger the TypeError
mosqueManager.actualTimes();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant