Return from ssl_load_buffered_record early if no record is buffered
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 19523ba..058173c 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -4730,11 +4730,6 @@
     if( hs == NULL )
         return( 0 );
 
-    /* Only consider loading future records if the
-     * input buffer is empty. */
-    if( ssl_another_record_in_datagram( ssl ) == 1 )
-        return( 0 );
-
     rec       = hs->buffering.future_record.data;
     rec_len   = hs->buffering.future_record.len;
     rec_epoch = hs->buffering.future_record.epoch;
@@ -4742,6 +4737,11 @@
     if( rec == NULL )
         return( 0 );
 
+    /* Only consider loading future records if the
+     * input buffer is empty. */
+    if( ssl_another_record_in_datagram( ssl ) == 1 )
+        return( 0 );
+
     MBEDTLS_SSL_DEBUG_MSG( 2, ( "=> ssl_load_buffered_record" ) );
 
     if( rec_epoch != ssl->in_epoch )