Skip to content

Commit

Permalink
fix issue #75
Browse files Browse the repository at this point in the history
  • Loading branch information
ShotgunNinja committed Mar 24, 2017
1 parent 0d49ed8 commit a3c816e
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Cache.cs
Expand Up @@ -189,17 +189,20 @@ public static void purge(ProtoVessel pv)
public static void update()
{
// purge the oldest entry from the vessel cache
UInt64 oldest_inc = UInt64.MaxValue;
UInt32 oldest_id = 0;
foreach(KeyValuePair<UInt32, vessel_info> pair in vessels)
if (vessels.Count > 0)
{
if (pair.Value.inc < oldest_inc)
UInt64 oldest_inc = UInt64.MaxValue;
UInt32 oldest_id = 0;
foreach(KeyValuePair<UInt32, vessel_info> pair in vessels)
{
oldest_inc = pair.Value.inc;
oldest_id = pair.Key;
if (pair.Value.inc < oldest_inc)
{
oldest_inc = pair.Value.inc;
oldest_id = pair.Key;
}
}
vessels.Remove(oldest_id);
}
if (oldest_id > 0) vessels.Remove(oldest_id);
}


Expand Down

0 comments on commit a3c816e

Please sign in to comment.