Better place to check invalid ID's
This commit is contained in:
parent
f96bd6cc3c
commit
07993a621b
@ -5336,7 +5336,7 @@ void Courtroom::announce_case(QString title, bool def, bool pro, bool jud,
|
||||
|
||||
void Courtroom::start_clock(int id)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->start();
|
||||
}
|
||||
@ -5344,7 +5344,7 @@ void Courtroom::start_clock(int id)
|
||||
|
||||
void Courtroom::start_clock(int id, qint64 msecs)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->start(static_cast<int>(msecs));
|
||||
}
|
||||
@ -5352,7 +5352,7 @@ void Courtroom::start_clock(int id, qint64 msecs)
|
||||
|
||||
void Courtroom::set_clock(int id, qint64 msecs)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->set(static_cast<int>(msecs), true);
|
||||
}
|
||||
@ -5360,7 +5360,7 @@ void Courtroom::set_clock(int id, qint64 msecs)
|
||||
|
||||
void Courtroom::pause_clock(int id)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->pause();
|
||||
}
|
||||
@ -5368,7 +5368,7 @@ void Courtroom::pause_clock(int id)
|
||||
|
||||
void Courtroom::stop_clock(int id)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->stop();
|
||||
}
|
||||
@ -5376,7 +5376,7 @@ void Courtroom::stop_clock(int id)
|
||||
|
||||
void Courtroom::set_clock_visibility(int id, bool visible)
|
||||
{
|
||||
if (id < max_clocks && ui_clock[id] != nullptr)
|
||||
if (id >= 0 && id < max_clocks && ui_clock[id] != nullptr)
|
||||
{
|
||||
ui_clock[id]->setVisible(visible);
|
||||
}
|
||||
|
@ -583,10 +583,6 @@ void AOApplication::server_packet_received(AOPacket *p_packet)
|
||||
// Timer ID is reserved as argument 0
|
||||
int id = f_contents.at(0).toInt();
|
||||
|
||||
// ID is invalid
|
||||
if (id < 0 || id >= w_courtroom->max_clocks)
|
||||
goto end;
|
||||
|
||||
// Type 0 = start/resume/sync timer at time
|
||||
// Type 1 = pause timer at time
|
||||
// Type 2 = show timer
|
||||
|
Loading…
Reference in New Issue
Block a user