Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 06:50:09 +01: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.
Dieser Commit ist enthalten in:
Ursprung
b69cc8eba5
Commit
3632ebda8b
@ -163,7 +163,11 @@ public class SkinProvider {
|
|||||||
|
|
||||||
public static CompletableFuture<Skin> requestSkin(UUID playerId, String textureUrl, boolean newThread) {
|
public static CompletableFuture<Skin> requestSkin(UUID playerId, String textureUrl, boolean newThread) {
|
||||||
if (textureUrl == null || textureUrl.isEmpty()) return CompletableFuture.completedFuture(EMPTY_SKIN);
|
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);
|
Skin cachedSkin = getCachedSkin(textureUrl);
|
||||||
if (cachedSkin != null) {
|
if (cachedSkin != null) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren