Fix crash in wxExecute() introduced by r73406.
Don't dereference potentially NULL wxProcess pointer. See #14931. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73425 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -556,7 +556,7 @@ long wxExecute(char **argv, int flags, wxProcess *process,
|
|||||||
// 1. wxPRIORITY_{MIN,DEFAULT,MAX} map to -20, 0 and 19 respectively.
|
// 1. wxPRIORITY_{MIN,DEFAULT,MAX} map to -20, 0 and 19 respectively.
|
||||||
// 2. The mapping is monotonously increasing.
|
// 2. The mapping is monotonously increasing.
|
||||||
// 3. The mapping is onto the target range.
|
// 3. The mapping is onto the target range.
|
||||||
int prio = process->GetPriority();
|
int prio = process ? process->GetPriority() : 0;
|
||||||
if ( prio <= 50 )
|
if ( prio <= 50 )
|
||||||
prio = (2*prio)/5 - 20;
|
prio = (2*prio)/5 - 20;
|
||||||
else if ( prio < 55 )
|
else if ( prio < 55 )
|
||||||
@@ -598,7 +598,7 @@ long wxExecute(char **argv, int flags, wxProcess *process,
|
|||||||
#endif // !__VMS
|
#endif // !__VMS
|
||||||
|
|
||||||
#if defined(HAVE_SETPRIORITY)
|
#if defined(HAVE_SETPRIORITY)
|
||||||
if ( setpriority(PRIO_PROCESS, 0, prio) != 0 )
|
if ( prio && setpriority(PRIO_PROCESS, 0, prio) != 0 )
|
||||||
{
|
{
|
||||||
wxLogSysError(_("Failed to set process priority"));
|
wxLogSysError(_("Failed to set process priority"));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user