mirror of
				https://github.com/LamGC/ContentGrabbingJi.git
				synced 2025-11-04 02:26:57 +00:00 
			
		
		
		
	[Change] SettingProperties 增加群号检查, 防止出现非法群号;
This commit is contained in:
		@ -51,6 +51,10 @@ public final class SettingProperties {
 | 
			
		||||
            long groupId;
 | 
			
		||||
            try {
 | 
			
		||||
                groupId = Long.parseLong(name.substring(name.indexOf("group.") + 6, name.lastIndexOf(".properties")));
 | 
			
		||||
                if(groupId <= 0) {
 | 
			
		||||
                    log.warn("无效的群配置文件: {}", groupId);
 | 
			
		||||
                    continue;
 | 
			
		||||
                }
 | 
			
		||||
            } catch (NumberFormatException e) {
 | 
			
		||||
                log.error("非法的配置文件名: {}", name);
 | 
			
		||||
                continue;
 | 
			
		||||
@ -233,7 +237,7 @@ public final class SettingProperties {
 | 
			
		||||
     * @return 如果群组存在所属Properties, 则返回群组Properties, 否则返回GlobalProperties.
 | 
			
		||||
     */
 | 
			
		||||
    public static Properties getProperties(long groupId) {
 | 
			
		||||
        if(groupPropMap.containsKey(groupId)) {
 | 
			
		||||
        if(groupId > 0 && groupPropMap.containsKey(groupId)) {
 | 
			
		||||
            return groupPropMap.get(groupId);
 | 
			
		||||
        }
 | 
			
		||||
        return getGlobalProperties();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user