Skip to content

Commit

Permalink
Fix: Handle undefined direction in alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored Jun 5, 2023
2 parents 412648c + 24a1a32 commit 878162b
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -14322,7 +14322,10 @@ condition_met (task_t task, report_t report, alert_t alert,
{
/* Same as "increased". */
if (cmp >= count)
return 1;
{
free (filter_id);
return 1;
}
}
else if (((strcasecmp (direction, "changed") == 0)
&& (abs (cmp) >= count))
Expand All @@ -14341,7 +14344,16 @@ condition_met (task_t task, report_t report, alert_t alert,
g_debug ("direction: %s", direction);
g_debug ("last_count: %i", last_count);
g_debug ("second_last_count NULL");
if (((strcasecmp (direction, "changed") == 0)
if (direction == NULL)
{
/* Same as "increased". */
if (last_count > 0)
{
free (filter_id);
return 1;
}
}
else if (((strcasecmp (direction, "changed") == 0)
|| (strcasecmp (direction, "increased") == 0))
&& (last_count > 0))
{
Expand Down

0 comments on commit 878162b

Please sign in to comment.