diff --git a/OpenSim/Data/MySQL/MySQLUserData.cs b/OpenSim/Data/MySQL/MySQLUserData.cs
index 3a088cf414..ecd534acf5 100644
--- a/OpenSim/Data/MySQL/MySQLUserData.cs
+++ b/OpenSim/Data/MySQL/MySQLUserData.cs
@@ -617,6 +617,10 @@ namespace OpenSim.Data.MySQL
/// The agent to create
public override void AddNewUserAgent(UserAgentData agent)
{
+ UUID zero = UUID.Zero;
+ if (agent.ProfileID == zero || agent.SessionID == zero)
+ return;
+
MySQLSuperManager dbm = GetLockedConnection();
try
{
diff --git a/OpenSim/Data/SQLite/SQLiteUserData.cs b/OpenSim/Data/SQLite/SQLiteUserData.cs
index 448ef853c0..94dc1d3576 100644
--- a/OpenSim/Data/SQLite/SQLiteUserData.cs
+++ b/OpenSim/Data/SQLite/SQLiteUserData.cs
@@ -567,6 +567,10 @@ namespace OpenSim.Data.SQLite
/// The agent to add to the database
override public void AddNewUserAgent(UserAgentData agent)
{
+ UUID zero = UUID.Zero;
+ if (agent.SessionID == zero || agent.ProfileID == zero)
+ return;
+
DataTable agents = ds.Tables["useragents"];
lock (ds)
{
diff --git a/OpenSim/Data/Tests/BasicUserTest.cs b/OpenSim/Data/Tests/BasicUserTest.cs
index 726ae84393..383091568a 100644
--- a/OpenSim/Data/Tests/BasicUserTest.cs
+++ b/OpenSim/Data/Tests/BasicUserTest.cs
@@ -143,8 +143,8 @@ namespace OpenSim.Data.Tests
{
UserProfileData u1 = db.GetUserByName(fname1,lname1);
UserProfileData u2 = db.GetUserByName(fname2,lname2);
- UserProfileData u3 = db.GetUserByName(fname3,lname3);
- Assert.That(user1,Is.EqualTo(u1.ID)); //??
+ UserProfileData u3 = db.GetUserByName(fname3,lname3);
+ Assert.That(user1,Is.EqualTo(u1.ID));
Assert.That(user2,Is.EqualTo(u2.ID));
Assert.That(user3,Is.EqualTo(u3.ID));
}
@@ -219,12 +219,8 @@ namespace OpenSim.Data.Tests
UserAgentData a4 = NewAgent(zero,agent4);
db.AddNewUserAgent(a0);
db.AddNewUserAgent(a4);
- UserAgentData a0a = db.GetAgentByUUID(user4);
- UserAgentData a4a = db.GetAgentByUUID(zero);
- Assert.That(zero,Is.EqualTo(a0a.SessionID));
- Assert.That(user4,Is.EqualTo(a0a.ProfileID));
- Assert.That(agent4,Is.EqualTo(a4a.SessionID));
- Assert.That(zero,Is.EqualTo(a4a.ProfileID));
+ Assert.That(db.GetAgentByUUID(user4),Is.Null);
+ Assert.That(db.GetAgentByUUID(zero),Is.Null);
}
[Test]