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

[Bug]: Uncaught TypeError: Cannot read properties of null (reading 'style') on game.js #166

Closed
1 task done
VaibhavYT opened this issue Jun 4, 2024 · 3 comments
Closed
1 task done
Labels

Comments

@VaibhavYT
Copy link

VaibhavYT commented Jun 4, 2024

The close function in game.js throws an Uncaught TypeError when attempting to access the style property of a null object. This occurs when document.getElementById(m) returns null, indicating that the element with the specified ID does not exist in the DOM.

physi-before screenshot
physi-before

What is the expected behavior? 🤔

When the close function is called with an ID that does not exist in the DOM, it should:

Silently do nothing: If the element with the specified ID is not found, the function should not attempt to access its properties or modify them.

Avoid throwing errors: The function should not throw an Uncaught TypeError or any other error, thereby preventing the application from crashing.

Ensure smooth UX: The overall user experience should remain unaffected, maintaining the application's stability and reliability.

Provide step by step information reproduce the bug 📄

1.Open the Application:
Load the application in a browser.

2.Trigger the close Function:

Perform an action that calls the close function with an ID that does not exist in the DOM.
For example, navigate to a part of the application that attempts to close a modal or section that has already been removed
or was never added to the DOM.

  1. Observe the Error:

Check the browser's console for the Uncaught TypeError: Cannot read properties of null (reading 'style') error message.
Confirm that the error occurs at the line document.getElementById(m).style.display="none"; within the close function.

Select program in which you are contributing

GSSoC24

Code of Conduct

Copy link

github-actions bot commented Jun 4, 2024

Hey @VaibhavYT! 👋

👉 Thanks for opening this issue. We appreciate your contribution and will look into it as soon as possible.
👉 Don’t forget to star our Physi-c-Tech and Follow Us on GitHub
👉 Make sure you join our Discord, we have created separate channels for all projects

@VaibhavYT
Copy link
Author

Assign me this issue

Copy link

Thank you for your contribution! If you have any questions or need further assistance, feel free to reach out to us on our Discord server: Discord. We have separate channels for all projects. Happy coding! 🚀

Connect with us on social media:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants