Fix crash when using -M with empty result

ledger -f /dev/null reg -M test causes a segmentation fault,
see bug 730 and duplicates 1080 and 1084 for details.

Kudos to Ikke for helping with debugging.
Merge pull request #340 from afh/pull/730

Fix crash when using -M with empty result