world switcher: fix race with fetching worlds while pinging

This commit is contained in:
Adam
2018-12-06 21:38:07 -05:00
parent c4595c1b9a
commit bca9403dc9
2 changed files with 3 additions and 3 deletions

View File

@@ -741,7 +741,7 @@ public class WorldHopperPlugin extends Plugin
for (World world : worldResult.getWorlds()) for (World world : worldResult.getWorlds())
{ {
int ping = Ping.ping(world); int ping = Ping.ping(world);
SwingUtilities.invokeLater(() -> panel.updatePing(world, ping)); SwingUtilities.invokeLater(() -> panel.updatePing(world.getId(), ping));
} }
stopwatch.stop(); stopwatch.stop();

View File

@@ -113,11 +113,11 @@ class WorldSwitcherPanel extends PluginPanel
} }
} }
void updatePing(World world, int ping) void updatePing(int world, int ping)
{ {
for (WorldTableRow worldTableRow : rows) for (WorldTableRow worldTableRow : rows)
{ {
if (worldTableRow.getWorld() == world) if (worldTableRow.getWorld().getId() == world)
{ {
worldTableRow.setPing(ping); worldTableRow.setPing(ping);