[PATCH] (try 2) comdlg32: check for NULL lfs in 16bit filedialog (Coverity)

Marcus Meissner marcus at jet.franken.de
Sun Feb 1 10:05:55 CST 2009


Hi,

CID 118, 119, think lfs (FD31_DATA*) could NULl in some cases.
This needs a weird call pattern I think, but check for it anyway.

oops, another compile failure. :( But this should be it.

Ciao, Marcus
---
 dlls/comdlg32/filedlg31.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/filedlg31.c b/dlls/comdlg32/filedlg31.c
index 3e43178..d17947f 100644
--- a/dlls/comdlg32/filedlg31.c
+++ b/dlls/comdlg32/filedlg31.c
@@ -355,10 +355,13 @@ static void FD31_UpdateFileTitle(const FD31_DATA *lfs)
 static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs )
 {
   LONG lRet;
-  HWND hWnd = lfs->hwnd;
+  HWND hWnd;
   LPWSTR pstr;
   WCHAR tmpstr[BUFFILE];
 
+  if (!lfs)
+      return FALSE;
+  hWnd = lfs->hwnd;
   /* get the raw string (with brackets) */
   lRet = SendDlgItemMessageW(hWnd, lst2, LB_GETCURSEL, 0, 0);
   if (lRet == LB_ERR) return TRUE;
@@ -393,9 +396,12 @@ static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs )
 static LRESULT FD31_FileListSelect( const FD31_DATA *lfs )
 {
     LONG lRet;
-    HWND hWnd = lfs->hwnd;
+    HWND hWnd;
     LPWSTR pstr;
 
+    if (!lfs)
+        return FALSE;
+    hWnd = lfs->hwnd;
     lRet = lfs->callbacks->SendLbGetCurSel(lfs);
     if (lRet == LB_ERR)
         return TRUE;
-- 
1.5.6



More information about the wine-patches mailing list