Skip to content

Commit

Permalink
[core/win32] Do not crash on GetPriorityClass() failure or on REALTIM…
Browse files Browse the repository at this point in the history
…E_PRIORITY_CLASS as return value
  • Loading branch information
eumagga0x2a committed Nov 25, 2019
1 parent 6d592bf commit e0c888a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions avidemux_core/ADM_core/src/ADM_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,16 @@ int getpriority(int which, int who)
ADM_assert(who == 0);

priorityClass = GetPriorityClass(GetCurrentProcess());
if(!priorityClass)
{
ADM_warning("Cannot get priority class.\n");
return 0;
}

switch (priorityClass)
{
case HIGH_PRIORITY_CLASS:
case REALTIME_PRIORITY_CLASS:
return -18;
break;
case ABOVE_NORMAL_PRIORITY_CLASS:
Expand Down

0 comments on commit e0c888a

Please sign in to comment.