From 1fda4964326f5552b47abfc8e9a01d9cb2fe89e7 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Mon, 31 Jan 2011 22:58:56 -0500
Subject: [PATCH] Fix crash bug in array-style metadata query for nullary
 functions. The shortcut way to construct an LLSD array of size n is to assign
 LLSD() to array[n-1]. That's fine -- as long as you remember not to do it for
 n == 0.

---
 indra/llcommon/lleventdispatcher.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/indra/llcommon/lleventdispatcher.cpp b/indra/llcommon/lleventdispatcher.cpp
index 2ab006a173a..e00cca366fc 100644
--- a/indra/llcommon/lleventdispatcher.cpp
+++ b/indra/llcommon/lleventdispatcher.cpp
@@ -443,7 +443,8 @@ struct LLEventDispatcher::ArrayParamsDispatchEntry: public LLEventDispatcher::Pa
     {
         LLSD array(LLSD::emptyArray());
         // Resize to number of arguments required
-        array[mArity - 1] = LLSD();
+        if (mArity)
+            array[mArity - 1] = LLSD();
         llassert_always(array.size() == mArity);
         meta["required"] = array;
         return meta;
-- 
GitLab