From ebd352b30b5b0278e613e1d1ecc60a5fc7756961 Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 09 Jan 2005 16:27:40 +0000 Subject: -Do not access the Array out of bounds -Check that there is a driver before asking to query a non existant --- (limited to 'noncore/settings') diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp index e8137dd..1b61a2e 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.cpp +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.cpp @@ -145,6 +145,7 @@ bool OTGateway::needsEnabling() { bool OTGateway::isEnabled() { if( getOTDevice()->deviceNr() >= 0 && + AllDrivers.count() != 0 && driver( getOTDevice()->deviceNr() )->isUp() ) return TRUE; diff --git a/noncore/settings/networksettings2/opietooth2/OTGateway.h b/noncore/settings/networksettings2/opietooth2/OTGateway.h index d97ef35..11c6b30 100644 --- a/noncore/settings/networksettings2/opietooth2/OTGateway.h +++ b/noncore/settings/networksettings2/opietooth2/OTGateway.h @@ -89,7 +89,7 @@ public : OTDriverList & getDriverList() { return AllDrivers; } OTDriver * driver( int nr ) - { return AllDrivers[nr]; } + { return AllDrivers.count() == 0 ? 0 : AllDrivers[nr]; } void updateDrivers(); PANConnectionVector getPANConnections(); -- cgit v0.9.0.2