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

fix: rdavydov/Twitch-Channel-Points-Miner-v2#251 #260

Merged
merged 1 commit into from
Jun 8, 2023

Conversation

nahSystemu
Copy link

Fixes #251

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Description

Addressing TypeError that occurs in the sync_campaigns function when a None object is passed to the Campaign class constructor. The error message states "'NoneType' object is not subscriptable," which means that a None object was accessed as if it were a dictionary.

To fix the issue, I've added a check to ensure that the campaigns_details[index] object is not None before passing it to the Campaign class constructor. If it is None, the loop will skip the current iteration, preventing the TypeError from occurring. The modified code block looks like this:

for index in range(0, len(campaigns_details)):
    if campaigns_details[index] is not None:
        campaign = Campaign(campaigns_details[index])
        if campaign.dt_match is True:
            campaign.clear_drops()
            if campaign.drops != []:
                campaigns.append(campaign)
    else:
        continue

Basically just making sure when campaigns_details[index] is None it just continues and doesn't post error to console

@rdavydov rdavydov self-requested a review May 2, 2023 07:23
@rdavydov rdavydov self-assigned this May 2, 2023
@rdavydov
Copy link
Owner

rdavydov commented Jun 8, 2023

Hehe, good idea. :)

@rdavydov rdavydov merged commit 748586c into rdavydov:master Jun 8, 2023
@rdavydov rdavydov removed their request for review June 8, 2023 20:02
lyw1217 pushed a commit to lyw1217/Twitch-Channel-Points-Miner-v2 that referenced this pull request Nov 5, 2023
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.

Campaign error
2 participants