Strange behavior on wake up by pin

I’m facing a strange issue.
I get following error message

2014-07-27 00:13:45 UTC+5.5 [Device] ERROR: the index ‘null’ does not exist
2014-07-27 00:13:45 UTC+5.5 [Device] ERROR: at start_sampler:311
2014-07-27 00:13:45 UTC+5.5 [Device] ERROR: from main:442
2014-07-27 00:13:45 UTC+5.5 [Device] ERROR: from main:513
for the code snippet
end_time = get_current_time();
end_time is a global variable. after this error, device reboots and then same thing works as expected.

I’m unable to find the root cause of this.

this problem occurs because it says end_time is a local variable and it is null. somehow imp is not able to set end_time to the value provided by get_current_time()

Rather hard to comment without seeing the whole code…