mirror of
				https://github.com/Ryujinx/SDL.git
				synced 2025-11-04 13:54:49 +00:00 
			
		
		
		
	Fixed divide by zero if the application has run out of GDI handles and is trying to show an error dialog
This commit is contained in:
		
							parent
							
								
									4295a6fe47
								
							
						
					
					
						commit
						08ce12c4e3
					
				| 
						 | 
				
			
			@ -297,9 +297,12 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption)
 | 
			
		|||
 | 
			
		||||
        /* Font size - convert to logical font size for dialog parameter. */
 | 
			
		||||
        {
 | 
			
		||||
            HDC ScreenDC = GetDC(0);
 | 
			
		||||
            WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / GetDeviceCaps(ScreenDC, LOGPIXELSY));
 | 
			
		||||
            ReleaseDC(0, ScreenDC);
 | 
			
		||||
            HDC ScreenDC = GetDC(NULL);
 | 
			
		||||
            int LogicalPixelsY = GetDeviceCaps(ScreenDC, LOGPIXELSY);
 | 
			
		||||
            if (!LogicalPixelsY) /* This can happen if the application runs out of GDI handles */
 | 
			
		||||
                LogicalPixelsY = 72;
 | 
			
		||||
            WordToPass = (WORD)(-72 * NCM.lfMessageFont.lfHeight / LogicalPixelsY);
 | 
			
		||||
            ReleaseDC(NULL, ScreenDC);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!AddDialogData(dialog, &WordToPass, 2)) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue