Stream thread Null pointer error
<p>I am currently having a problem with retrieving an object from a stream in a thread. I am currently getting a null pointer error where it is trying to read from a stream. The input stream is instantiated in a service class so that only one connection for the app is needed. Can anyone see if there is any obvious reason as to why i am getting a null pointer error.</p>

<pre><code>@Override
public void run() {
    try {
        while(true){
            while ((mess = (com.DrawTastic.Message) messRec.readObject()) != null) {

                runOnUiThread(new Runnable() {
                    public void run() {

                        mAdapter.add(mess);

                    }
                });
            }
        }

    } catch (IOException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}
</code></pre>

<p>error trace:</p>

<pre><code>03-27 23:08:10.800: ERROR/AndroidRuntime(2218): FATAL EXCEPTION: Thread-13
03-27 23:08:10.800: ERROR/AndroidRuntime(2218): java.lang.NullPointerException
03-27 23:08:10.800: ERROR/AndroidRuntime(2218):     at com.DrawTastic.ChatActivity.run(ChatActivity.java:149)
03-27 23:08:10.800: ERROR/AndroidRuntime(2218):     at java.lang.Thread.run(Thread.java:1019)
</code></pre>
