* fix invalid pointer access in the handling of WM_PAINT before InitVideo has

allocated videobuf in the win16 video unit

git-svn-id: trunk@37638 -
This commit is contained in:
nickysn 2017-12-01 14:35:50 +00:00
parent 87846323c2
commit d3d60568e7

View File

@ -52,6 +52,9 @@ var
CharWidth,CharHeight: SmallInt;
begin
dc:=BeginPaint(hwnd,FarAddr(ps));
{ don't do anything, before the video unit has been fully initialized... }
if videobuf<>nil then
begin
oldfont:=SelectObject(dc,GetStockObject(OEM_FIXED_FONT));
GetTextMetrics(dc,FarAddr(Metrics));
CharWidth:=Metrics.tmMaxCharWidth;
@ -81,6 +84,7 @@ begin
SetTextColor(dc,oldtextcolor);
SetBkColor(dc,oldbkcolor);
SelectObject(dc,oldfont);
end;
EndPaint(hwnd,FarAddr(ps));
end;