git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26825
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
#endif
// Handle User's home (ignore root homes!)
#endif
// Handle User's home (ignore root homes!)
- size_t len = 0;
- if ((val = wxGetUserHome (user)) != NULL &&
- (len = wxStrlen(val)) > 2 &&
- wxStrncmp(dest, val, len) == 0)
- {
- wxStrcpy(wxFileFunctionsBuffer, wxT("~"));
- if (user != wxT(""))
- wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user);
- wxStrcat(wxFileFunctionsBuffer, dest + len);
- wxStrcpy (dest, wxFileFunctionsBuffer);
- }
+ val = wxGetUserHome (user);
+ if (!val)
+ return dest;
+
+ const size_t len = wxStrlen(val);
+ if (len <= 2)
+ return dest;
+
+ if (wxStrncmp(dest, val, len) == 0)
+ {
+ wxStrcpy(wxFileFunctionsBuffer, wxT("~"));
+ if (user != wxT(""))
+ wxStrcat(wxFileFunctionsBuffer, (const wxChar*) user);
+ wxStrcat(wxFileFunctionsBuffer, dest + len);
+ wxStrcpy (dest, wxFileFunctionsBuffer);
+ }