Hack to avoid div-by-zero

This commit is contained in:
simon.kagstrom 2010-02-25 12:24:10 +00:00
parent 115a12b958
commit 619fcc1be5

View File

@ -121,6 +121,8 @@ Network::~Network()
void Network::Tick(int ms) void Network::Tick(int ms)
{ {
if (ms == 0)
ms = 1;
int last_kbps = ((this->traffic - this->last_traffic) * 8) * (1000 / ms); int last_kbps = ((this->traffic - this->last_traffic) * 8) * (1000 / ms);
/* 1/3 of the new value, 2/3 of the old */ /* 1/3 of the new value, 2/3 of the old */