Correct handling of offer creation without a range

The workaround for JSON serialisation introduced a bug that was
triggered when the offer contained no range, which is allowed for
certain offer types. In that case range is None, and accessing range.id
threw an error.

Fixes #1167. Thanks to @izidormatusov for reporting.