File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
packages/device_info_plus/device_info_plus/lib/src Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ library device_info_plus_windows;
33
44import 'dart:ffi' ;
55import 'dart:typed_data' ;
6+ import 'dart:developer' as developer;
67
78import 'package:device_info_plus_platform_interface/device_info_plus_platform_interface.dart' ;
89import 'package:ffi/ffi.dart' ;
@@ -124,8 +125,8 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
124125 if (result != 0 ) {
125126 return memoryInKilobytes.value ~ / 1024 ;
126127 } else {
127- final error = GetLastError ();
128- throw WindowsException ( HRESULT_FROM_WIN32 (error)) ;
128+ developer. log ( 'Failed to get system memory' , error : GetLastError () );
129+ return 0 ;
129130 }
130131 } finally {
131132 free (memoryInKilobytes);
@@ -149,7 +150,8 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
149150 if (result != 0 ) {
150151 return lpBuffer.toDartString ();
151152 } else {
152- throw WindowsException (HRESULT_FROM_WIN32 (GetLastError ()));
153+ developer.log ('Failed to get computer name' , error: GetLastError ());
154+ return "" ;
153155 }
154156 } finally {
155157 free (lpBuffer);
@@ -167,7 +169,8 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
167169 if (result != 0 ) {
168170 return lpBuffer.toDartString ();
169171 } else {
170- throw WindowsException (HRESULT_FROM_WIN32 (GetLastError ()));
172+ developer.log ('Failed to get user name' , error: GetLastError ());
173+ return "" ;
171174 }
172175 } finally {
173176 free (pcbBuffer);
You can’t perform that action at this time.
0 commit comments