Skip to content

1206: Covered possible NullPointerException in InjectAViewModelDialog.java #1213

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

Conversation

Mgonzalez-droid
Copy link
Contributor

@Mgonzalez-droid Mgonzalez-droid commented Sep 26, 2022

Description (*)

I added conditional logic to test if the given variable is null, if null we will return and avoid execution of the code that could through a NPE. If the code is fine then it will continue as normal.

Fixed Issues (if relevant)

  1. Fixes [Bug] Possible NullPointerException exception in actions/generation/dialog/InjectAViewModelDialog.java:145 #1206

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with integration/functional tests (if applicable)
  • All automated tests passed successfully (all builds are green)

…ull we will return and avoid execution of the code that could through a NPE. If the code is fine then it will continue as normal.
@Mgonzalez-droid
Copy link
Contributor Author

Let me know if there is anything else I might have missed, Thank you again for your help!

Copy link
Collaborator

@bohdan-harniuk bohdan-harniuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @Mgonzalez-droid!
Please, take a look at my suggestion.
Regards,

@bohdan-harniuk bohdan-harniuk changed the title I added conditional logic to test if the given variable is null, if n… 1206: Covered possible NullPointerException in InjectAViewModelDialog.java Sep 26, 2022
…InjectAViewModelDialog.java

Co-authored-by: bohdan-harniuk <31848341+bohdan-harniuk@users.noreply.github.com>
@bohdan-harniuk
Copy link
Collaborator

Hello, @Mgonzalez-droid!
I've shown for you how to make condition easier.
Please, read what you have submitted.
It should be done by hands, not via GitHub shortcut.
Not code is broken.
Regards,

@Mgonzalez-droid
Copy link
Contributor Author

I went ahead and made the change you suggested, made a mistake by assuming git would correctly format the code how you suggested. Do apologize, this latest commit should be what you were looking for. If not let me know and I will address it right away. Thank you!

@bohdan-harniuk
Copy link
Collaborator

@Mgonzalez-droid, there is no need to keep else clause. Take a look at line 140:

 if (!validateFormFields()) {
            exit();
            return;
        }

There is no else. Adding else here makes it more nested without any particular reason.
Regards,

@bohdan-harniuk
Copy link
Collaborator

Hello, @Mgonzalez-droid!
Any updates here?
Regards,

@VitaliyBoyko VitaliyBoyko changed the base branch from 4.4.1-develop to 5.0.1-develop December 18, 2022 07:49
@VitaliyBoyko VitaliyBoyko merged commit 2b39dde into magento:5.0.1-develop Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Possible NullPointerException exception in actions/generation/dialog/InjectAViewModelDialog.java:145
3 participants