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

[gog] 'gog failed: Cannot read properties of null (reading '1')' #398

Open
shinji257 opened this issue Nov 2, 2024 · 3 comments
Open

[gog] 'gog failed: Cannot read properties of null (reading '1')' #398

shinji257 opened this issue Nov 2, 2024 · 3 comments

Comments

@shinji257
Copy link

No description provided.

@FluffyClaws
Copy link

Did you know that the more info on an issue is provided the more easily it is to locate and fix?

Nevertheless, I did encounter the same error, BUT, after running the script the second time after claiming the game.

Full error looks like following:

TypeError: Cannot read properties of null (reading '1')
    at file:///free-games-claimer/gog.js:102:62

So I would assume the issue is that on the consecutive runs the matching text is not found returning null, and attempting to access [1] on the null value.

const title = text.match(/Claim (.*) and don't miss the/)[1];

I`ve never encountered this before personally, and I run the script twice each time, so most likely the are some changes on the GoG website that have caused this. Not sure how to test without a giveaway though.

@vinnymac
Copy link

I can confirm this happens after there are no more games to claim, so likely a change on the site occurred. If a game is available to claim it works just fine.

@jordyamc
Copy link

jordyamc commented Nov 20, 2024

I changed it to this to fix this error

- const title = text.match(/Claim (.*) and don't miss the/)[1];
+ const match_all = text.match(/Claim (.*) and don't miss the|Success! (.*) was added to/);
+ const title = match_all[1] ? match_all[1] : match_all[2];

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

4 participants