[danbooruservice] Check the blacklist outside the loop
Otherwise we keep on accessing a deleted post and we crash
This commit is contained in:
		
					parent
					
						
							
								fe630c753e
							
						
					
				
			
			
				commit
				
					
						d99fd19d22
					
				
			
		
					 1 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -336,14 +336,22 @@ void DanbooruService::processPostList(KJob* job)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // second check, blacklist
 | 
					        // second check, blacklist
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        bool inBlacklist = false;
 | 
				
			||||||
        for (auto tag: post->tags()) {
 | 
					        for (auto tag: post->tags()) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (m_blacklist.contains(tag)) {
 | 
					            if (m_blacklist.contains(tag)) {
 | 
				
			||||||
                m_currentPosts--;
 | 
					                inBlacklist = true;
 | 
				
			||||||
                delete post;
 | 
					                break;
 | 
				
			||||||
                continue;
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if (inBlacklist) {
 | 
				
			||||||
 | 
					            m_currentPosts--;
 | 
				
			||||||
 | 
					            delete post;
 | 
				
			||||||
 | 
					            continue;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        QPixmap pix;
 | 
					        QPixmap pix;
 | 
				
			||||||
        // QPixmap* pix = new QPixmap();
 | 
					        // QPixmap* pix = new QPixmap();
 | 
				
			||||||
        bool result;
 | 
					        bool result;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue