From bfac43798bbe3b74b6eeced4251e7a81fe58043e Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Wed, 14 Oct 2020 11:17:16 +0100 Subject: [PATCH] riched20: Don't return the diTextStart paragraph from para_prev(). Signed-off-by: Huw Davies Signed-off-by: Alexandre Julliard --- dlls/riched20/caret.c | 6 ++---- dlls/riched20/para.c | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 5f7d52aa4cf..c56e5961f73 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -774,12 +774,10 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs) { para = run->para; /* Skip empty start of table row paragraph */ - if (para_prev( para )->nFlags & MEPF_ROWSTART) + if (para_prev( para ) && para_prev( para )->nFlags & MEPF_ROWSTART) para = para_prev( para ); /* Paragraph breaks are treated as separate words */ - if (para_get_di( para_prev( para ) )->type == diTextStart) - return FALSE; - + if (!para_prev( para )) return FALSE; para = para_prev( para ); run = para_end_run( para ); } diff --git a/dlls/riched20/para.c b/dlls/riched20/para.c index 99ce1706631..431f89faed3 100644 --- a/dlls/riched20/para.c +++ b/dlls/riched20/para.c @@ -64,7 +64,7 @@ ME_Paragraph *para_next( ME_Paragraph *para ) ME_Paragraph *para_prev( ME_Paragraph *para ) { - if (para->prev_para) return ¶->prev_para->member.para; + if (para->prev_para && para->prev_para->type == diParagraph) return ¶->prev_para->member.para; return NULL; }