Module: wine Branch: master Commit: 820460fccecb3eb25e983a85088ed8c9ec2b785f URL: http://source.winehq.org/git/wine.git/?a=commit;h=820460fccecb3eb25e983a8508...
Author: Aric Stewart aric@codeweavers.com Date: Thu Oct 27 13:38:00 2011 -0500
user32: Handle PosFromChar if the string is empty and so we have no ssa.
---
dlls/user32/edit.c | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index f8cf757..71df7e6 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -1069,11 +1069,16 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap) EDIT_UpdateUniscribeData(es, NULL, 0); if (es->x_offset) { - if (es->x_offset>= get_text_length(es)) + if (es->x_offset >= get_text_length(es)) { - const SIZE *size; - size = ScriptString_pSize(es->ssa); - xoff = size->cx; + if (es->ssa) + { + const SIZE *size; + size = ScriptString_pSize(es->ssa); + xoff = size->cx; + } + else + xoff = 0; } ScriptStringCPtoX(es->ssa, es->x_offset, FALSE, &xoff); } @@ -1081,9 +1086,14 @@ static LRESULT EDIT_EM_PosFromChar(EDITSTATE *es, INT index, BOOL after_wrap) { if (index >= get_text_length(es)) { - const SIZE *size; - size = ScriptString_pSize(es->ssa); - xi = size->cx; + if (es->ssa) + { + const SIZE *size; + size = ScriptString_pSize(es->ssa); + xi = size->cx; + } + else + xi = 0; } else ScriptStringCPtoX(es->ssa, index, FALSE, &xi);