Don't construct a new FirefoxBinary() if one is already provided.
The FirefoxBinary() constructor can throw, so avoid calling it in this case, where the result is going to be discarded anyway.
@@ -194,7 +194,7 @@ public FirefoxOptions setBinary(String path) {
* useful when actually starting firefox.
*/
public FirefoxBinary getBinary() {
- return getBinaryOrNull().orElse(new FirefoxBinary());
+ return getBinaryOrNull().orElseGet(() -> new FirefoxBinary());
}
public Optional<FirefoxBinary> getBinaryOrNull() {
