Merge pull request #143 from kenvix/master

Fixed a issue that cause bot initialization failed on headless platform
This commit is contained in:
Him188 2020-03-15 10:09:49 -05:00 committed by GitHub
commit 3a57d51b47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,11 +49,15 @@ class DefaultLoginSolver(
}
tempFile.inputStream().use {
val img = ImageIO.read(it)
if (img == null) {
logger.info("无法创建字符图片. 请查看文件")
} else {
logger.info(img.createCharImg())
try {
val img = ImageIO.read(it)
if (img == null) {
logger.info("无法创建字符图片. 请查看文件")
} else {
logger.info(img.createCharImg())
}
} catch (throwable: Throwable) {
logger.info("创建字符图片时出错(${throwable.toString()})。请查看文件")
}
}
}