aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorUbitUmarov2018-12-29 13:29:39 +0000
committerUbitUmarov2018-12-29 13:29:39 +0000
commit7679617d5290d24c92b42043fc6d924d37620c89 (patch)
treea2140b48fca02d5abfd1f9e239e3605b85cf3299 /OpenSim/Data
parentstill pgsql (diff)
downloadopensim-SC-7679617d5290d24c92b42043fc6d924d37620c89.zip
opensim-SC-7679617d5290d24c92b42043fc6d924d37620c89.tar.gz
opensim-SC-7679617d5290d24c92b42043fc6d924d37620c89.tar.bz2
opensim-SC-7679617d5290d24c92b42043fc6d924d37620c89.tar.xz
change DBGSuids a bit, let it return uuid.zero in more fail cases, not killing region
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/DBGuids.cs23
1 files changed, 12 insertions, 11 deletions
diff --git a/OpenSim/Data/DBGuids.cs b/OpenSim/Data/DBGuids.cs
index 1a2bf41..ed0e7ca 100644
--- a/OpenSim/Data/DBGuids.cs
+++ b/OpenSim/Data/DBGuids.cs
@@ -47,24 +47,25 @@ namespace OpenSim.Data
47 if ((id == null) || (id == DBNull.Value)) 47 if ((id == null) || (id == DBNull.Value))
48 return UUID.Zero; 48 return UUID.Zero;
49 49
50 if (id.GetType() == typeof(Guid)) 50 Type idtype = id.GetType();
51
52 if (idtype == typeof(Guid))
51 return new UUID((Guid)id); 53 return new UUID((Guid)id);
52 54
53 if (id.GetType() == typeof(byte[])) 55 if (id.GetType() == typeof(string))
54 { 56 {
55 if (((byte[])id).Length == 0) 57 Guid gg;
56 return UUID.Zero; 58 if (Guid.TryParse((string)id, out gg))
57 else if (((byte[])id).Length == 16) 59 return new UUID(gg);
58 return new UUID((byte[])id, 0); 60 return UUID.Zero;
59 } 61 }
60 else if (id.GetType() == typeof(string)) 62
63 if (idtype == typeof(byte[]))
61 { 64 {
62 if (((string)id).Length == 0) 65 if (((byte[])id).Length < 16)
63 return UUID.Zero; 66 return UUID.Zero;
64 else if (((string)id).Length == 36) 67 return new UUID((byte[])id, 0);
65 return new UUID((string)id);
66 } 68 }
67
68 throw new Exception("Failed to convert db value to UUID: " + id.ToString()); 69 throw new Exception("Failed to convert db value to UUID: " + id.ToString());
69 } 70 }
70 } 71 }