Skip to content

Commit bb833f3

Browse files
authored
Merge pull request #601 from cjakeman/video-ram-bugfix
Video-RAM message to logfile fails under VMWare
2 parents 84cd5e1 + 7e68b23 commit bb833f3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Source/ORTS.Common/SystemInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ static void WriteEnvironment(TextWriter output)
7474
{
7575
foreach (ManagementObject display in new ManagementClass("Win32_VideoController").GetInstances())
7676
{
77-
output.WriteLine("Video = {0} ({1:F1} GB RAM){2}", (string)display["Description"], (float)(uint)display["AdapterRAM"] / 1024 / 1024 / 1024, GetPnPDeviceDrivers(display));
77+
// ? used as display["AdapterRAM"] may be null on a virtual machine (e.g. VMWare)
78+
output.WriteLine("Video = {0} ({1:F1} GB RAM){2}", (string)display["Description"], (float?)(uint?)display["AdapterRAM"] / 1024 / 1024 / 1024, GetPnPDeviceDrivers(display));
7879
}
7980
}
8081
catch (Exception error)

0 commit comments

Comments
 (0)