From: <ma...@us...> - 2003-12-22 21:54:19
|
Update of /cvsroot/sharedaemon/ui-wx/src In directory sc8-pr-cvs1:/tmp/cvs-serv19736 Modified Files: Images.cpp Log Message: Avoid crash if requested image is not found. Index: Images.cpp =================================================================== RCS file: /cvsroot/sharedaemon/ui-wx/src/Images.cpp,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- Images.cpp 22 Dec 2003 05:04:15 -0000 1.41 +++ Images.cpp 22 Dec 2003 21:54:16 -0000 1.42 @@ -59,8 +59,8 @@ images.DeleteContents(true); images.Clear(); - path = MakePath(); - + path = MakePath(); + images.Append( wxT("friend"), new wxBitmap(path+wxT("friend.png"), wxBITMAP_TYPE_ANY) @@ -256,6 +256,7 @@ wxT("Requested image `%s` could not be found!"), name.c_str() )); + return wxNullBitmap; } return *(tmp->GetData()); @@ -356,28 +357,28 @@ mdc.GetTextExtent(names.Item(i), &x, &y); x+=6; y+=36; - x>tool_img_width ? tool_img_width=x : x=tool_img_width; + x>tool_img_width ? tool_img_width=x : x=tool_img_width; y>tool_img_height ? tool_img_height=y : y=tool_img_width; } } - -/****************************************************************** MakePath */ -/* This method creates a platform-dependant path string for accessing images */ -/* from. Since various platforms use various standard locations for resouce */ -/* locations, this method handles it as follows: */ -/* Win32 @executable_path@/images/@iconsetname@/ */ -/* Linux @executable_path@/images/@iconsetname@/ */ -/* Mac OS X */ -/* CodeWarrior :@executable_path@::Resources:images:@iconsetname@ */ -/* GNU gcc @executable_path@/images/@iconsetname@/ */ -/* */ -/* TODO: Use /usr/share area on Linux */ -/* Check various locations, detect if images can be found. */ -/*****************************************************************************/ -wxString CImages::MakePath() { - wxString path, apppath; + +/****************************************************************** MakePath */ +/* This method creates a platform-dependant path string for accessing images */ +/* from. Since various platforms use various standard locations for resouce */ +/* locations, this method handles it as follows: */ +/* Win32 @executable_path@/images/@iconsetname@/ */ +/* Linux @executable_path@/images/@iconsetname@/ */ +/* Mac OS X */ +/* CodeWarrior :@executable_path@::Resources:images:@iconsetname@ */ +/* GNU gcc @executable_path@/images/@iconsetname@/ */ +/* */ +/* TODO: Use /usr/share area on Linux */ +/* Check various locations, detect if images can be found. */ +/*****************************************************************************/ +wxString CImages::MakePath() { + wxString path, apppath; wxChar sep; - + /** * We get the application binary path from argv[0], remove the binary * name from it, and use it as base for our resources. Needed if @@ -401,7 +402,7 @@ m_config->Read( wxT("/General/IconSets/CurIconSet"), &path, wxT("Default") ); - path.MakeLower(); + path.MakeLower(); path = wxString::Format( wxT("%simages/%s/"), apppath.c_str(), path.c_str() ); @@ -415,7 +416,7 @@ path.Replace(wxT("/"), wxT(":")); path.Prepend(wxT(":")); path.Prepend(wxT("::Resources")); - #endif - + #endif + return path; -} +} |