diff options
author | Justin Clark-Casey (justincc) | 2012-10-25 01:07:06 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-25 01:07:06 +0100 |
commit | ae662b54ea972e4da4f805fe38b5714d595e032a (patch) | |
tree | bbb79e30a6b42e25b5edec4abc6c56e5432cb4ea /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Add TestOsNpcLoadAppearance() (diff) | |
download | opensim-SC_OLD-ae662b54ea972e4da4f805fe38b5714d595e032a.zip opensim-SC_OLD-ae662b54ea972e4da4f805fe38b5714d595e032a.tar.gz opensim-SC_OLD-ae662b54ea972e4da4f805fe38b5714d595e032a.tar.bz2 opensim-SC_OLD-ae662b54ea972e4da4f805fe38b5714d595e032a.tar.xz |
Make osNpcCreate() return UUID.Zero instead of throwing an exception if notecard name is invalid. Make osNpcLoadAppearance() fail silently in same circumstance rather than throwing exception.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 29bc163..804b0af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -1780,18 +1780,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
1780 | protected string LoadNotecard(string notecardNameOrUuid) | 1780 | protected string LoadNotecard(string notecardNameOrUuid) |
1781 | { | 1781 | { |
1782 | UUID assetID = CacheNotecard(notecardNameOrUuid); | 1782 | UUID assetID = CacheNotecard(notecardNameOrUuid); |
1783 | StringBuilder notecardData = new StringBuilder(); | ||
1784 | 1783 | ||
1785 | for (int count = 0; count < NotecardCache.GetLines(assetID); count++) | 1784 | if (assetID != UUID.Zero) |
1786 | { | 1785 | { |
1787 | string line = NotecardCache.GetLine(assetID, count) + "\n"; | 1786 | StringBuilder notecardData = new StringBuilder(); |
1788 | 1787 | ||
1789 | // m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); | 1788 | for (int count = 0; count < NotecardCache.GetLines(assetID); count++) |
1790 | 1789 | { | |
1791 | notecardData.Append(line); | 1790 | string line = NotecardCache.GetLine(assetID, count) + "\n"; |
1791 | |||
1792 | // m_log.DebugFormat("[OSSL]: From notecard {0} loading line {1}", notecardNameOrUuid, line); | ||
1793 | |||
1794 | notecardData.Append(line); | ||
1795 | } | ||
1796 | |||
1797 | return notecardData.ToString(); | ||
1792 | } | 1798 | } |
1793 | 1799 | ||
1794 | return notecardData.ToString(); | 1800 | return null; |
1795 | } | 1801 | } |
1796 | 1802 | ||
1797 | /// <summary> | 1803 | /// <summary> |
@@ -2407,6 +2413,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2407 | return; | 2413 | return; |
2408 | 2414 | ||
2409 | string appearanceSerialized = LoadNotecard(notecard); | 2415 | string appearanceSerialized = LoadNotecard(notecard); |
2416 | |||
2417 | if (appearanceSerialized == null) | ||
2418 | return; | ||
2419 | |||
2410 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2420 | OSDMap appearanceOsd = (OSDMap)OSDParser.DeserializeLLSDXml(appearanceSerialized); |
2411 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); | 2421 | // OSD a = OSDParser.DeserializeLLSDXml(appearanceSerialized); |
2412 | // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); | 2422 | // Console.WriteLine("appearanceSerialized {0}", appearanceSerialized); |