ul_tbf: Fix accessing zeroed block when checking if transfer is complete

The logic checking whether the UL TBF had already been sent all the data
(and hence was marked as finished and requesting UL ACK to be sent) was
not taking into account the case where there was still no valid block
stored, ie. when the first received UL data block was discarded for some
reason (ex: because TLLI was not set during content resolution).

Related: OS#1940
Change-Id: I739e67ae1bb40555a362170f26fb98ac69caabb2
diff --git a/src/tbf_ul.cpp b/src/tbf_ul.cpp
index e92a920..231ed06 100644
--- a/src/tbf_ul.cpp
+++ b/src/tbf_ul.cpp
@@ -528,7 +528,8 @@
 
 	/* Check if we already received all data TBF had to send: */
 	if (this->state_is(GPRS_RLCMAC_FLOW) /* still in flow state */
-	 && this->m_window.v_q() == this->m_window.v_r()) { /* if complete */
+	 && this->m_window.v_q() == this->m_window.v_r() /* if complete */
+	 && block->len) { /* if there was ever a last block received */
 		LOGPTBFUL(this, LOGL_DEBUG,
 			  "No gaps in received block, last block: BSN=%d CV=%d\n",
 			  rdbi->bsn, rdbi->cv);
@@ -542,7 +543,7 @@
 
 	/* If TLLI is included or if we received half of the window, we send
 	 * an ack/nack */
-	maybe_schedule_uplink_acknack(rlc, rdbi->cv == 0);
+	maybe_schedule_uplink_acknack(rlc, block->len && rdbi->cv == 0);
 
 	return 0;
 }