From aec3b330119a6c4e799939329bd0748ce1a265be Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 14 Jul 2010 23:48:24 +0100
Subject: fix bug where prim persistence would fail if media had never been set

---
 OpenSim/Data/SQLite/SQLiteRegionData.cs | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'OpenSim/Data')

diff --git a/OpenSim/Data/SQLite/SQLiteRegionData.cs b/OpenSim/Data/SQLite/SQLiteRegionData.cs
index 51f4cef..7acbd22 100644
--- a/OpenSim/Data/SQLite/SQLiteRegionData.cs
+++ b/OpenSim/Data/SQLite/SQLiteRegionData.cs
@@ -1919,14 +1919,17 @@ namespace OpenSim.Data.SQLite
             row["Texture"] = s.TextureEntry;
             row["ExtraParams"] = s.ExtraParams;
             
-            OSDArray meArray = new OSDArray();
-            foreach (MediaEntry me in s.Media)
+            if (null != s.Media)
             {
-                OSD osd = (null == me ? new OSD() : me.GetOSD());
-                meArray.Add(osd);
+                OSDArray meArray = new OSDArray();
+                foreach (MediaEntry me in s.Media)
+                {
+                    OSD osd = (null == me ? new OSD() : me.GetOSD());
+                    meArray.Add(osd);
+                }
+                
+                row["Media"] = OSDParser.SerializeLLSDXmlString(meArray);
             }
-            
-            row["Media"] = OSDParser.SerializeLLSDXmlString(meArray);
         }
 
         /// <summary>
-- 
cgit v1.1