java.lang.ArrayIndexOutOfBoundsException: length=0; index=1
<p>I am doing messaging platform.Msgdesc is my message but somebody send message ,somebody dont.So ı have some date in msgdesc.if ı havent exist any data ı want to do nothing but if i want i want to see also msgdesc with name+surname.But i am getting <strong>java.lang.ArrayIndexOutOfBoundsException: length=0; index=1</strong>
Can anybody help me?</p>

<p>Code:</p>

<pre><code>for (int i = 0; i &lt; midArr.length; i++) {
    //getting desc from db
    getMessagedbXML = messagedbInstance.getMessages(mid,midArr[i]);             
    parseXMLDB(getMessagedbXML);
    UserList=new String[midArr.length];
    **//getting error here**    
    if((msgdesc[i].length()==0)) {
        UserList[i] = nameArr[i]+" "+surnameArr[i];
    } else {
        UserList[i] = nameArr[i]+" "+surnameArr[i]+" "+msgdesc[i];
    }
}
</code></pre>
