[dss-commits] r8810 - dss/trunk/core
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Thu Oct 1 11:10:55 CEST 2009
Author: pstaehlin
Date: 2009-10-01 11:10:55 +0200 (Thu, 01 Oct 2009)
New Revision: 8810
Modified:
dss/trunk/core/model.cpp
Log:
Make sure we're getting sane values for lastCalledScene
Modified: dss/trunk/core/model.cpp
===================================================================
--- dss/trunk/core/model.cpp 2009-10-01 08:38:26 UTC (rev 8809)
+++ dss/trunk/core/model.cpp 2009-10-01 09:10:55 UTC (rev 8810)
@@ -818,9 +818,13 @@
try {
int lastCalledScene = interface.getLastCalledScene(modulatorID, zoneID, groupID);
Group* pGroup = zone.getGroup(groupID);
+ assert(pGroup != NULL);
log(" zoneID: " + intToString(zoneID) + " groupID: " + intToString(groupID) + " lastScene: " + intToString(lastCalledScene));
- assert(pGroup != NULL);
- onGroupCallScene(zoneID, groupID, lastCalledScene);
+ if(lastCalledScene < 0 || lastCalledScene > 63) {
+ log("Zone id is out of bounds. zoneID: " + intToString(zoneID) + " groupID: " + intToString(groupID) + " lastScene: " + intToString(lastCalledScene), lsError);
+ } else {
+ onGroupCallScene(zoneID, groupID, lastCalledScene);
+ }
} catch(runtime_error& error) {
log(string("Error getting last called scene '") + error.what() + "'", lsError);
}
@@ -1427,6 +1431,10 @@
void Apartment::onGroupCallScene(const int _zoneID, const int _groupID, const int _sceneID) {
try {
+ if(_sceneID < 0 || _sceneID > 63) {
+ log("Zone id is out of bounds. zoneID: " + intToString(_zoneID) + " groupID: " + intToString(_groupID) + " lastScene: " + intToString(_sceneID), lsError);
+ return;
+ }
Zone& zone = getZone(_zoneID);
Group* group = zone.getGroup(_groupID);
if(group != NULL) {
@@ -1466,6 +1474,10 @@
void Apartment::onDeviceCallScene(const int _modulatorID, const int _deviceID, const int _sceneID) {
try {
+ if(_sceneID < 0 || _sceneID > 63) {
+ log("Zone id is out of bounds. modulator-id '" + intToString(_modulatorID) + "' for device '" + intToString(_deviceID) + "' scene: " + intToString(_sceneID), lsError);
+ return;
+ }
Modulator& mod = getModulatorByBusID(_modulatorID);
try {
log("OnDeviceCallScene: modulator-id '" + intToString(_modulatorID) + "' for device '" + intToString(_deviceID) + "' scene: " + intToString(_sceneID));
More information about the dss-commits
mailing list