BrowserProcessor: guard stop() against a partially failed start()

If start() throws after the proxy is started but before the browser
launches, stop() could NPE on the null fields.
This commit is contained in:
Alex Osborne
2026-07-10 15:59:47 +09:00
parent d03a43266a
commit 1b107f06c1
@@ -109,15 +109,19 @@ public class BrowserProcessor extends Processor {
public void stop() {
if (!isRunning) return;
super.stop();
try {
proxy.stop();
} catch (Exception e) {
logger.log(ERROR, "Error stopping proxy server", e);
if (proxy != null) {
try {
proxy.stop();
} catch (Exception e) {
logger.log(ERROR, "Error stopping proxy server", e);
}
}
try {
webdriver.close();
} catch (Exception e) {
logger.log(ERROR, "Error closing WebDriverBiDi", e);
if (webdriver != null) {
try {
webdriver.close();
} catch (Exception e) {
logger.log(ERROR, "Error closing WebDriverBiDi", e);
}
}
}