From b5a04332312d1431e8e94575c7b2df4dae8dd770 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Thu, 21 Jul 2005 11:28:39 +0000 Subject: [PATCH] Allow NULL parameter for WM_SETTEXT in RichEdit. --- dlls/riched20/editor.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index b98ded00d83..c56cb26031a 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1180,12 +1180,21 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP } case WM_SETTEXT: { - LPWSTR wszText = ME_ToUnicode(hWnd, (void *)lParam); - TRACE("WM_SETTEXT - %s\n", (char *)(wszText)); /* debugstr_w() */ ME_InternalDeleteText(editor, 0, ME_GetTextLength(editor)); - /* uses default style! */ - ME_InsertTextFromCursor(editor, 0, wszText, -1, editor->pBuffer->pDefaultStyle); - ME_EndToUnicode(hWnd, wszText); + if (lParam) + { + LPWSTR wszText = ME_ToUnicode(hWnd, (void *)lParam); + TRACE("WM_SETTEXT lParam==%lx\n",lParam); + TRACE("WM_SETTEXT - %s\n", debugstr_w(wszText)); /* debugstr_w() */ + if (lstrlenW(wszText) > 0) + { + /* uses default style! */ + ME_InsertTextFromCursor(editor, 0, wszText, -1, editor->pBuffer->pDefaultStyle); + } + ME_EndToUnicode(hWnd, wszText); + } + else + TRACE("WM_SETTEXT - NULL\n"); ME_CommitUndo(editor); ME_EmptyUndoStack(editor); ME_UpdateRepaint(editor);