Skip to content

Commit

Permalink
Let Timeline handle non-existing bugs
Browse files Browse the repository at this point in the history
If an history entry refers to a bug that does not exist in the database,
history_get_event_from_row() throws application error 1100.

Even though it is not a normal situation to find orphan records in the
history table, the overhead of verifying a bug's existence at the
beginning of the loop is negligible, so it doesn't hurt to add the extra
bug_exists() check.

Fixes #20727
  • Loading branch information
dregad committed May 29, 2016
1 parent 4d46f8e commit ef2628e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/history_api.php
Expand Up @@ -240,6 +240,11 @@ function history_get_event_from_row( $p_result, $p_user_id = null, $p_check_acce
while ( $t_row = db_fetch_array( $p_result ) ) {
extract( $t_row, EXTR_PREFIX_ALL, 'v' );

# Ignore entries related to non-existing bugs (see #20727)
if( !bug_exists( $v_bug_id ) ) {
continue;
}

# Make sure the entry belongs to current project.
if ( $t_project_id != ALL_PROJECTS && $t_project_id != bug_get_field( $v_bug_id, 'project_id' ) ) {
continue;
Expand Down

0 comments on commit ef2628e

Please sign in to comment.