From 505e241c8ab3e26da503283ab83531b52f827061 Mon Sep 17 00:00:00 2001 From: ibs Date: Mon, 24 Apr 2017 19:23:55 +0300 Subject: [PATCH] 0028679: Foundation Classes - OSD_Process::UserName rises EXC_BAD_ACCESS on iphone simulator check for a null pointer is added --- src/OSD/OSD_Process.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/OSD/OSD_Process.cxx b/src/OSD/OSD_Process.cxx index c2373463b5..84a1d57401 100644 --- a/src/OSD/OSD_Process.cxx +++ b/src/OSD/OSD_Process.cxx @@ -84,12 +84,10 @@ Standard_Integer OSD_Process::ProcessId(){ return (getpid()); } -TCollection_AsciiString OSD_Process::UserName(){ - struct passwd *infos; - infos = getpwuid(getuid()); - TCollection_AsciiString result=infos->pw_name; - - return(result); +TCollection_AsciiString OSD_Process::UserName() +{ + struct passwd *anInfos = getpwuid (getuid()); + return TCollection_AsciiString (anInfos ? anInfos->pw_name : ""); } Standard_Boolean OSD_Process::IsSuperUser (){