summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rondeau2010-11-02 15:59:51 -0400
committerTom Rondeau2010-11-02 15:59:51 -0400
commit428ccb2218464a33923b3e576ad42af21468c82d (patch)
tree6e7bdf3f2ced1b5cd878814edeb4c0f30a2279a3
parent0bc7116e5227f95b7a5de944bc65c5a8b55e0ed5 (diff)
downloadgnuradio-428ccb2218464a33923b3e576ad42af21468c82d.tar.gz
gnuradio-428ccb2218464a33923b3e576ad42af21468c82d.tar.bz2
gnuradio-428ccb2218464a33923b3e576ad42af21468c82d.zip
Adding some protection to the nitems read/written accessors. Should this return 0 or throw?
-rw-r--r--gnuradio-core/src/lib/runtime/gr_block.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/gnuradio-core/src/lib/runtime/gr_block.cc b/gnuradio-core/src/lib/runtime/gr_block.cc
index f3e0ecc91..e0a223135 100644
--- a/gnuradio-core/src/lib/runtime/gr_block.cc
+++ b/gnuradio-core/src/lib/runtime/gr_block.cc
@@ -120,13 +120,25 @@ gr_block::fixed_rate_noutput_to_ninput(int noutput)
gr_uint64
gr_block::n_items_read(unsigned int which_input)
{
- return d_detail->n_items_read(which_input);
+ if(d_detail) {
+ return d_detail->n_items_read(which_input);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
}
gr_uint64
gr_block::n_items_written(unsigned int which_output)
{
- return d_detail->n_items_written(which_output);
+ if(d_detail) {
+ return d_detail->n_items_written(which_output);
+ }
+ else {
+ //throw std::runtime_error("No block_detail associated with block yet");
+ return 0;
+ }
}
void