зеркало из https://github.com/mono/hal-sharp.git
2006-07-18 Aaron Bockover <abock@gnome.org>
* src/HalDevice.cs: Added null checks for Hal.Context to prevent crashing in places svn path=/trunk/hal-sharp/; revision=62707
This commit is contained in:
Родитель
73c7448332
Коммит
c005ff984d
|
@ -1,3 +1,8 @@
|
|||
2006-07-18 Aaron Bockover <abock@gnome.org>
|
||||
|
||||
* src/HalDevice.cs: Added null checks for Hal.Context to prevent
|
||||
crashing in places
|
||||
|
||||
2006-01-13 Eric Butler <eric@extremeboredom.net>
|
||||
|
||||
* configure.ac: Generate makefile in doc directory, check for monodoc
|
||||
|
|
|
@ -45,6 +45,10 @@ namespace Hal
|
|||
|
||||
public Device(Context ctx, string udi)
|
||||
{
|
||||
if(ctx == null) {
|
||||
throw new ApplicationException("Cannot create HAL device; context is null");
|
||||
}
|
||||
|
||||
this.ctx = ctx;
|
||||
this.udi = udi;
|
||||
}
|
||||
|
@ -258,7 +262,7 @@ namespace Hal
|
|||
|
||||
public static bool DeviceExists(Context ctx, string udi)
|
||||
{
|
||||
return Unmanaged.libhal_device_exists(ctx.Raw, udi, IntPtr.Zero);
|
||||
return ctx == null ? false : Unmanaged.libhal_device_exists(ctx.Raw, udi, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static string [] FindUdis(Context ctx, FindBy findMethod, string key, string query)
|
||||
|
@ -266,7 +270,11 @@ namespace Hal
|
|||
IntPtr ptr;
|
||||
string [] deviceUdis;
|
||||
int device_count;
|
||||
|
||||
|
||||
if(ctx == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
switch(findMethod) {
|
||||
case FindBy.StringMatch:
|
||||
ptr = Unmanaged.libhal_manager_find_device_string_match(
|
||||
|
@ -291,6 +299,10 @@ namespace Hal
|
|||
|
||||
public static Device [] UdisToDevices(Context ctx, string [] udis)
|
||||
{
|
||||
if(ctx == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Device [] devices = new Device[udis.Length];
|
||||
|
||||
for(int i = 0; i < udis.Length; i++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче