gril: fix cancel_group/offline crash (LP: 1262340)

When the modem is set offline (for FlightMode), the
core ofono code will call remove() for the call-volume
and netreg drivers, which will result in the low-level
gril function ril_cancel_group() function being called.
This low-level function has a bug in its queue logic
which can result in commands which have already been
sent to rild being removed.  This causes problems when
a response is received, as the code asserts that the
command_queue length is >0 when an incoming response is
received.  This fix is based on a nemomobile ofono fix:
 - https://github.com/nemomobile-packages/ofono/
 - commit: 1266c212271e44db59aab2ef5d773b0afa015e48
 - Author: Jarko Poutiainen <Jarko.Poutiainen@oss.tieto.com>

Please refer to the LP bug for testing instructions:

https://bugs.launchpad.net/ubuntu/+source/ofono/+bug/1262340