add some error handling
parent
affd6cbeb3
commit
8295c88818
|
@ -257,23 +257,38 @@ namespace OpenSim.Modules.EMail
|
||||||
public Email GetNextEmail(UUID objectID, string sender, string subject)
|
public Email GetNextEmail(UUID objectID, string sender, string subject)
|
||||||
{
|
{
|
||||||
SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(objectID);
|
SceneObjectPart sceneObject = m_scene.GetSceneObjectPart(objectID);
|
||||||
m_log.Info("[" + Name + "] GetNextEmail: " + sceneObject.Name + " (" + sceneObject.UUID + ")");
|
|
||||||
|
|
||||||
|
if(sceneObject != null)
|
||||||
|
{
|
||||||
List<InternalMail> messages = m_messages.FindAll(X => X.ID == objectID);
|
List<InternalMail> messages = m_messages.FindAll(X => X.ID == objectID);
|
||||||
if (messages.Count == 0)
|
if (messages.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if(messages[0] != null)
|
||||||
|
{
|
||||||
Email lslMessage = new Email();
|
Email lslMessage = new Email();
|
||||||
|
|
||||||
lslMessage.time = messages[0].Mail.Date.ToUnixTimeSeconds().ToString();
|
lslMessage.time = messages[0].Mail.Date.ToUnixTimeSeconds().ToString();
|
||||||
lslMessage.message = messages[0].Mail.Body.ToString();
|
lslMessage.message = messages[0].Mail.TextBody.ToString();
|
||||||
lslMessage.sender = messages[0].Mail.Sender.GetAddress(true);
|
lslMessage.sender = messages[0].Mail.Sender.GetAddress(true);
|
||||||
lslMessage.subject = messages[0].Mail.Subject;
|
lslMessage.subject = messages[0].Mail.Subject;
|
||||||
lslMessage.numLeft = messages.Count - 1;
|
lslMessage.numLeft = messages.Count - 1;
|
||||||
|
|
||||||
m_messages.Remove(messages[0]);
|
m_messages.Remove(messages[0]);
|
||||||
|
|
||||||
return lslMessage;
|
return lslMessage;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Error("[" + Name + "] Cant find caller objekt!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_log.Error("[" + Name + "] Cant find caller objekt!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool isUUID(string thing)
|
public bool isUUID(string thing)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue