diff --git a/modules/codec/cea708.c b/modules/codec/cea708.c index 2df2f3cf3c..bba6ca19b4 100644 --- a/modules/codec/cea708.c +++ b/modules/codec/cea708.c @@ -605,6 +605,8 @@ static void CEA708_Window_Truncate( cea708_window_t *p_w, int i_direction ) for( int i=p_w->i_firstrow; i <= p_w->i_lastrow; i++ ) { cea708_text_row_t *row = p_w->rows[i]; + if (!row) + continue; if( row->lastcol == i_max ) { if( row->firstcol >= row->lastcol ) @@ -616,6 +618,12 @@ static void CEA708_Window_Truncate( cea708_window_t *p_w, int i_direction ) else if( i == p_w->i_lastrow ) p_w->i_lastrow--; } + else + { + /* Drop rightmost column */ + row->lastcol--; + } + } } } @@ -626,6 +634,8 @@ static void CEA708_Window_Truncate( cea708_window_t *p_w, int i_direction ) for( int i=p_w->i_firstrow; i <= p_w->i_lastrow; i++ ) { cea708_text_row_t *row = p_w->rows[i]; + if (!row) + continue; if( row->firstcol == i_min ) { if( row->firstcol >= row->lastcol ) @@ -637,6 +647,12 @@ static void CEA708_Window_Truncate( cea708_window_t *p_w, int i_direction ) else if( i == p_w->i_lastrow ) p_w->i_lastrow--; } + else + { + /* Drop leftmost column */ + row->firstcol++; + } + } } }