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 a NullPointerException in RemoteWebDriver.getCurrentUrl #1327

Closed
wants to merge 1 commit into from

Conversation

ekuefler
Copy link
Contributor

execute() is allowed to return null (see line 643), which will cause a
NullPointerException to be thrown in getCurrentUrl. This doesn't fix the
underlying problem, but it causes it to throw a WebDriverException
instead of a NullPointerException so the user can handle it in a
reasonable way.

@@ -323,7 +323,12 @@ public String getTitle() {
}

public String getCurrentUrl() {
return execute(DriverCommand.GET_CURRENT_URL).getValue().toString();
Response response = execute(DriverCommand.GET_CURRENT_URL);
if (response == null) {
Copy link
Member

Choose a reason for hiding this comment

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

can you also add || response.getValue() != null

@lukeis lukeis added the C-java label Dec 8, 2015
@lukeis
Copy link
Member

lukeis commented Dec 8, 2015

also can you confirm you've signed the CLA

execute() is allowed to return null (see line 643), which will cause a
NullPointerException to be thrown in getCurrentUrl. This doesn't fix the
underlying problem, but it causes it to throw a WebDriverException
instead of a NullPointerException so the user can handle it in a
reasonable way.
@ekuefler
Copy link
Contributor Author

Addressed comment. Yes, I've signed the CLA.

@lukeis
Copy link
Member

lukeis commented Dec 11, 2015

merged as d94c64f

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

Successfully merging this pull request may close these issues.

None yet

2 participants