From 013c5faf3e4e7310ebdd37f31ef3023925f58ec2 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Wed, 3 Dec 2014 12:51:36 -0800 Subject: [PATCH] error handling. --- src/bitcoindjs.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bitcoindjs.cc b/src/bitcoindjs.cc index 20a8b444..e364fadd 100644 --- a/src/bitcoindjs.cc +++ b/src/bitcoindjs.cc @@ -2259,6 +2259,9 @@ NAN_METHOD(GetBlockByTime) { async_block_time_data *data = new async_block_time_data(); + data->gte = 0; + data->lte = 0; + uv_work_t *req = new uv_work_t(); req->data = data; @@ -2286,6 +2289,10 @@ NAN_METHOD(GetBlockByTime) { static void async_block_time(uv_work_t *req) { async_block_time_data* data = static_cast(req->data); + if (!data->gte && !data->lte) { + data->err_msg = std::string("gte and lte not found."); + return; + } int64_t i = 0; // XXX Slow: figure out how to ballpark the height based on gte and lte. int64_t height = chainActive.Height();