Skip to content

only call .replace if object exists #52

Merged
chiabre merged 1 commit intochiabre:1.1.33from
jlamb1:none-typecheck-fix
Apr 7, 2026
Merged

only call .replace if object exists #52
chiabre merged 1 commit intochiabre:1.1.33from
jlamb1:none-typecheck-fix

Conversation

@jlamb1
Copy link
Copy Markdown
Contributor

@jlamb1 jlamb1 commented Apr 6, 2026

I came across this error in my logs using the MBTALive 2.0 HACS integration:

Unexpected error in __is_alert_relevant: 'NoneType' object has no attribute 'replace'
Traceback (most recent call last): File "/usr/local/lib/python3.14/site-packages/mbtaclient/handlers/base_handler.py",
line 411, in __is_alert_relevant active_period_end = mbta_alert.active_period_end.replace(tzinfo=None) 
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'replace'

this adds a simple check to only call .replace() if exists.

This may be similar to issue #49

@chiabre chiabre changed the base branch from main to 1.1.33 April 7, 2026 21:38
@chiabre chiabre merged commit 64a2505 into chiabre:1.1.33 Apr 7, 2026
1 of 3 checks passed
chiabre added a commit that referenced this pull request Apr 7, 2026
* Bump version from 1.1.32 to 1.1.33

* check if exist before replacing (#52)

---------

Co-authored-by: jlamb1 <lambj71@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants