Skip to content

Commit be873c9

Browse files
committedMay 18, 2017
Fix various app crashed related to resource system
1 parent 256f2ce commit be873c9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed
 

‎colorspace.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1350,6 +1350,9 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray*prhs[])
13501350
******************************************************************************/
13511351
void MiredColorTemperatureToXY(unsigned short int temperature, unsigned short int *x, unsigned short int *y)
13521352
{
1353+
if (temperature == 0)
1354+
temperature = 153;
1355+
13531356
unsigned long long localX, localY;
13541357
unsigned short int temp = 1000000 / temperature;
13551358

‎light_node.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -380,9 +380,14 @@ void LightNode::setColorTemperature(uint16_t colorTemperature)
380380
*/
381381
const QString &LightNode::colorMode() const
382382
{
383+
static QString foo;
383384
const ResourceItem *i = item(RStateColorMode);
384385
DBG_Assert(i != 0);
385-
return i->toString();
386+
if (i)
387+
{
388+
return i->toString();
389+
}
390+
return foo;
386391
}
387392

388393
/*! Sets the current colormode.

‎rest_groups.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,7 @@ int DeRestPluginPrivate::setGroupState(const ApiRequest &req, ApiResponse &rsp)
12301230

12311231
item = i->item(RStateHue);
12321232

1233-
if (item->toNumber() != hue)
1233+
if (item && item->toNumber() != hue)
12341234
{
12351235
i->setEnhancedHue(hue);
12361236
item->setValue(hue);
@@ -2150,8 +2150,7 @@ int DeRestPluginPrivate::storeScene(const ApiRequest &req, ApiResponse &rsp)
21502150
needModify = true;
21512151
}
21522152
}
2153-
2154-
if (item->toString() == QLatin1String("ct"))
2153+
else if (item->toString() == QLatin1String("ct"))
21552154
{
21562155
item = lightNode->item(RStateCt);
21572156
DBG_Assert(item != 0);

0 commit comments

Comments
 (0)
Please sign in to comment.