[Change] CacheStoreCentral 调整'getImageById'方法中对'pageIndex'的参数值检查时机;

[Change] MiraiMessageSender 增加警告忽略注释;
This commit is contained in:
LamGC 2020-06-08 19:13:51 +08:00
parent ad289f952f
commit 6789b5b7c5
2 changed files with 6 additions and 1 deletions

View File

@ -98,6 +98,10 @@ public final class CacheStoreCentral {
*/
public static String getImageById(long fromGroup, int illustId, PixivDownload.PageQuality quality, int pageIndex) {
log.debug("IllustId: {}, Quality: {}, PageIndex: {}", illustId, quality.name(), pageIndex);
if(pageIndex <= 0) {
log.warn("指定的页数不能小于或等于0: {}", pageIndex);
return "指定的页数不能小于或等于0";
}
try {
if (BotCommandProcess.isNoSafe(illustId, SettingProperties.getProperties(fromGroup), false)) {
@ -128,7 +132,7 @@ public final class CacheStoreCentral {
log.debug(logBuilder.toString());
}
if (pagesList.size() < pageIndex || pageIndex <= 0) {
if (pagesList.size() < pageIndex) {
log.warn("指定的页数超出了总页数({} / {})", pageIndex, pagesList.size());
return "指定的页数超出了范围(总共 " + pagesList.size() + " 页)";
}

View File

@ -134,6 +134,7 @@ public class MiraiMessageSender implements MessageSender {
* @param code 图片BotCode
* @return Image对象
*/
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter")
public Image uploadImage(BotCode code) {
log.debug("传入BotCode信息:\n{}", code);
String absolutePath = code.getParameter("absolutePath");