Fix a few pref calls to check or assert for errors

This commit is contained in:
blythe%netscape.com 1998-07-24 22:56:50 +00:00
Родитель fd97cbd817
Коммит b2fd4c6cf1
7 изменённых файлов: 22 добавлений и 21 удалений

Просмотреть файл

@ -169,9 +169,6 @@ CAnimation2::CAnimation2( CWnd *pParent, LPUNKNOWN pUnk ): CWnd()
m_ToolTip.Create(this); m_ToolTip.Create(this);
#endif #endif
char *pURL;
PREF_CopyConfigString("toolbar.logo.url",&pURL);
if( !CUST_IsCustomAnimation( &m_iFrameCount ) ) if( !CUST_IsCustomAnimation( &m_iFrameCount ) )
{ {
m_ToolTip.AddTool(this, szLoadString(IDS_NETSCAPE_TIP)); m_ToolTip.AddTool(this, szLoadString(IDS_NETSCAPE_TIP));
@ -361,9 +358,9 @@ void CAnimation2::OnLButtonUp( UINT nFlags, CPoint point )
ASSERT(pCX != NULL); ASSERT(pCX != NULL);
if (pCX != NULL) if (pCX != NULL)
{ {
char *pURL; char *pURL = NULL;
PREF_CopyConfigString("toolbar.logo.url",&pURL); int iError = PREF_CopyConfigString("toolbar.logo.url",&pURL);
if (pURL && *pURL) { if (PREF_ERROR != iError && pURL && *pURL) {
pCX->NormalGetUrl(pURL); pCX->NormalGetUrl(pURL);
XP_FREE(pURL); XP_FREE(pURL);
} }

Просмотреть файл

@ -30,19 +30,20 @@
BOOL CUST_IsCustomAnimation(int * iFrames) BOOL CUST_IsCustomAnimation(int * iFrames)
{ {
char *pFile; char *pFile = NULL;
BOOL bRet = FALSE; BOOL bRet = FALSE;
// set iFrames to default // set iFrames to default
PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); int iError = PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile);
if (pFile) { if (PREF_ERROR != iError && pFile) {
if (*pFile) bRet = TRUE; if (*pFile) bRet = TRUE;
XP_FREE(pFile); XP_FREE(pFile);
pFile = NULL; pFile = NULL;
} }
PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); pFile = NULL;
if (pFile) { iError = PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile);
if (PREF_ERROR != iError && pFile) {
if (*pFile) bRet = TRUE; if (*pFile) bRet = TRUE;
XP_FREE(pFile); XP_FREE(pFile);
pFile = NULL; pFile = NULL;

Просмотреть файл

@ -660,8 +660,8 @@ NET_StreamClass *external_viewer_disk_stream(int iFormatOut, void *pDataObj, URL
} }
if(bMoreInfo == TRUE) { if(bMoreInfo == TRUE) {
char * url = NULL; char * url = NULL;
PREF_CopyConfigString("internal_url.more_info_plugin.url",&url); int iError = PREF_CopyConfigString("internal_url.more_info_plugin.url",&url);
if (url) { if (PREF_ERROR != iError && url) {
CString csUrlAddress = url; CString csUrlAddress = url;
csUrlAddress += "?"; csUrlAddress += "?";
csUrlAddress += pUrl->content_type; csUrlAddress += pUrl->content_type;

Просмотреть файл

@ -2976,7 +2976,8 @@ HBITMAP wfe_LoadBitmap(HINSTANCE hInst, HDC hDC, LPCSTR pszBmName )
HBITMAP hCust = NULL; HBITMAP hCust = NULL;
CString csProfileFile; CString csProfileFile;
PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile); int iError = PREF_CopyConfigString("toolbar.logo.win_large_file",&pFile);
ASSERT(iError != PREF_ERROR);
// we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir // we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir
csProfileFile = theApp.m_UserDirectory; csProfileFile = theApp.m_UserDirectory;
@ -2995,7 +2996,8 @@ HBITMAP wfe_LoadBitmap(HINSTANCE hInst, HDC hDC, LPCSTR pszBmName )
HBITMAP hCust = NULL; HBITMAP hCust = NULL;
CString csProfileFile; CString csProfileFile;
PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile); int iError = PREF_CopyConfigString("toolbar.logo.win_small_file",&pFile);
ASSERT(iError != PREF_ERROR);
// we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir // we need to first check the profile for the file (for PE) and then resort to the default of the EXE dir
csProfileFile = theApp.m_UserDirectory; csProfileFile = theApp.m_UserDirectory;

Просмотреть файл

@ -601,8 +601,9 @@ void CMainFrame::OnLoadHomePage()
if (bOverride) { if (bOverride) {
// if the over-ride preference is set, use that instead // if the over-ride preference is set, use that instead
PREF_CopyConfigString("startup.homepage_override_url",&tmpBuf); tmpBuf = NULL;
if (tmpBuf && tmpBuf[0]) { int iError = PREF_CopyConfigString("startup.homepage_override_url",&tmpBuf);
if (PREF_ERROR != iError && tmpBuf && tmpBuf[0]) {
csTmp = tmpBuf; csTmp = tmpBuf;
lpszHomePage = csTmp; lpszHomePage = csTmp;
XP_FREE(tmpBuf); XP_FREE(tmpBuf);

Просмотреть файл

@ -391,9 +391,9 @@ void CMainFrame::OnUpdateToggleImageLoad(CCmdUI* pCmdUI)
void CMainFrame::OnNetSearch() void CMainFrame::OnNetSearch()
{ {
char * url = NULL; char * url = NULL;
PREF_CopyConfigString("internal_url.net_search.url",&url); int iError = PREF_CopyConfigString("internal_url.net_search.url",&url);
if(GetMainContext() && url) if(PREF_ERROR != iError && GetMainContext() && url)
{ {
GetMainContext()->NormalGetUrl(url); GetMainContext()->NormalGetUrl(url);
XP_FREE(url); XP_FREE(url);

Просмотреть файл

@ -918,8 +918,8 @@ CString CNetscapeApp::ResolveAppVersion() {
csReturn += csVersion; csReturn += csVersion;
char *pCustAgent = NULL; char *pCustAgent = NULL;
PREF_CopyConfigString("user_agent",&pCustAgent); int iError = PREF_CopyConfigString("user_agent",&pCustAgent);
if (pCustAgent) { if (PREF_ERROR != iError && pCustAgent) {
if (*pCustAgent) { if (*pCustAgent) {
csReturn += "C-"; csReturn += "C-";
csReturn += pCustAgent; csReturn += pCustAgent;