fix: a possible bug

at rare conditions ,  the for loop will continue to run until the request is canceled.
This commit is contained in:
xiaoyifang 2023-03-27 09:49:20 +08:00 committed by xiaoyifang
parent e84b5aa861
commit 83f299bbc3

6
mdx.cc
View file

@ -750,8 +750,10 @@ void MddResourceRequest::run()
return;
}
string u8ResourceName = Utf8::encode( resourceName );
if( !resourceIncluded.insert( resourceName ).second )
continue;
if( !resourceIncluded.insert( resourceName ).second ) {
finish();
return;
}
Mutex::Lock _( dataMutex );
data.clear();