mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-08-28 09:26:54 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user