nullptr read access violation while checking in loop : <p>I have this code:</p>

<pre><code>while (current-&gt;next-&gt;data &lt;= temp-&gt;data &amp;&amp; current-&gt;next != nullptr)
        {
            current = current-&gt;next;
        }
</code></pre>

<p>when I run it i get the error:</p>

<p>Exception thrown: read access violation.
    current->next was nullptr.</p>

<p>I believe I should not be receiving this error because it is the exact thing I check for; I am new to this, is there something I am doing wrong?</p>
