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