diff --git a/lib/include/srslte/common/pdu.h b/lib/include/srslte/common/pdu.h index 20fe91816..5d0f5a235 100644 --- a/lib/include/srslte/common/pdu.h +++ b/lib/include/srslte/common/pdu.h @@ -136,13 +136,12 @@ public: nof_subheaders = 0; bool ret = false; do { - if (nof_subheaders < (int) max_subheaders) { + if (nof_subheaders < (int)max_subheaders) { ret = subheaders[nof_subheaders].read_subheader(&ptr); + nof_subheaders++; } - } while (ret && nof_subheaders < (int) max_subheaders); - if (nof_subheaders + 1 < (int) max_subheaders) { - nof_subheaders++; - } + } while (ret && (nof_subheaders + 1) < (int)max_subheaders); + for (int i=0;ierror("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders); log_h->console("Trying to write packet with invalid number of subheaders (nof_subheaders=%d).\n", nof_subheaders); return NULL;