mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Prevent concurrency issues with SkinProvider#requestedSkins
There is a small potential here to return null if containsKey runs before remove and then get is called.
This commit is contained in:
parent
b69cc8eba5
commit
3632ebda8b
1 changed files with 5 additions and 1 deletions
|
@ -163,7 +163,11 @@ public class SkinProvider {
|
|||
|
||||
public static CompletableFuture<Skin> requestSkin(UUID playerId, String textureUrl, boolean newThread) {
|
||||
if (textureUrl == null || textureUrl.isEmpty()) return CompletableFuture.completedFuture(EMPTY_SKIN);
|
||||
if (requestedSkins.containsKey(textureUrl)) return requestedSkins.get(textureUrl); // already requested
|
||||
CompletableFuture<Skin> requestedSkin = requestedSkins.get(textureUrl);
|
||||
if (requestedSkin != null) {
|
||||
// already requested
|
||||
return requestedSkin;
|
||||
}
|
||||
|
||||
Skin cachedSkin = getCachedSkin(textureUrl);
|
||||
if (cachedSkin != null) {
|
||||
|
|
Loading…
Reference in a new issue