diff options
author | David Walter Seikel | 2013-04-21 19:43:57 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-04-21 19:43:57 +1000 |
commit | 305f086cdd84249f16602f775e87979ce3c66a4d (patch) | |
tree | 612f30f95c1b103e7381a050b0a4f73d42f96a0c | |
parent | Potential fix for http://redmine.kokuaviewer.org/issues/1215 but needs testing. (diff) | |
download | meta-impy-305f086cdd84249f16602f775e87979ce3c66a4d.zip meta-impy-305f086cdd84249f16602f775e87979ce3c66a4d.tar.gz meta-impy-305f086cdd84249f16602f775e87979ce3c66a4d.tar.bz2 meta-impy-305f086cdd84249f16602f775e87979ce3c66a4d.tar.xz |
Fix http://redmine.kokuaviewer.org/issues/1139 and provide better protection against NULL callbacks.
-rw-r--r-- | linden/indra/newview/llinventorymodel.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/linden/indra/newview/llinventorymodel.cpp b/linden/indra/newview/llinventorymodel.cpp index 40cbc43..8b98782 100644 --- a/linden/indra/newview/llinventorymodel.cpp +++ b/linden/indra/newview/llinventorymodel.cpp | |||
@@ -455,8 +455,6 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
455 | void (*callback)(const LLSD&, void*), | 455 | void (*callback)(const LLSD&, void*), |
456 | void* user_data) | 456 | void* user_data) |
457 | { | 457 | { |
458 | llassert_always(NULL != callback); | ||
459 | |||
460 | LLUUID id; | 458 | LLUUID id; |
461 | 459 | ||
462 | if(!isInventoryUsable()) | 460 | if(!isInventoryUsable()) |
@@ -464,7 +462,8 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
464 | llwarns << "Inventory is broken." << llendl; | 462 | llwarns << "Inventory is broken." << llendl; |
465 | LLSD result; | 463 | LLSD result; |
466 | result["failure"] = true; | 464 | result["failure"] = true; |
467 | callback(result, user_data); | 465 | if (callback) |
466 | callback(result, user_data); | ||
468 | } | 467 | } |
469 | 468 | ||
470 | 469 | ||
@@ -473,7 +472,8 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
473 | LL_DEBUGS("Inventory") << "Attempt to create simstate category." << LL_ENDL; | 472 | LL_DEBUGS("Inventory") << "Attempt to create simstate category." << LL_ENDL; |
474 | LLSD result; | 473 | LLSD result; |
475 | result["failure"] = true; | 474 | result["failure"] = true; |
476 | callback(result, user_data); | 475 | if (callback) |
476 | callback(result, user_data); | ||
477 | } | 477 | } |
478 | 478 | ||
479 | id.generate(); | 479 | id.generate(); |
@@ -492,10 +492,8 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
492 | name.assign(NEW_CATEGORY_NAME); | 492 | name.assign(NEW_CATEGORY_NAME); |
493 | } | 493 | } |
494 | 494 | ||
495 | if (user_data) // callback required for acked message. | 495 | if ((NULL != callback) && (NULL != user_data)) // callback required for acked message. |
496 | { | 496 | { |
497 | |||
498 | |||
499 | LLViewerRegion* viewer_region = gAgent.getRegion(); | 497 | LLViewerRegion* viewer_region = gAgent.getRegion(); |
500 | 498 | ||
501 | if (!viewer_region->capabilitiesReceived()) | 499 | if (!viewer_region->capabilitiesReceived()) |
@@ -537,7 +535,10 @@ LLUUID LLInventoryModel::createNewCategory(const LLUUID& parent_id, | |||
537 | { | 535 | { |
538 | // user_data is a LLCategoryCreate object instantiated in the calling | 536 | // user_data is a LLCategoryCreate object instantiated in the calling |
539 | // function - bug (or low memory - any leaks?). | 537 | // function - bug (or low memory - any leaks?). |
540 | llwarns << "NULL user_data" << llendl; | 538 | // Or, it might just be no problem, since passing the callback in the first place is optional. |
539 | // It's really up to the calling function to know what it passed to pass back to the callback. | ||
540 | if (callback) | ||
541 | llwarns << "NULL user_data" << llendl; | ||
541 | } | 542 | } |
542 | 543 | ||
543 | // Add the category to the internal representation | 544 | // Add the category to the internal representation |