Skip to content

Infinite loop if "until nil" #234

@ceneon

Description

@ceneon

Hey,

Just wondering if it would make sense to submit a PR for this use case.

I experienced a weird app error and the app ended up calling business_days_until(x) with x being nil.

This produces an unhandled infinite loop because calling that nil generates an infinite range inside the business_time gem, and calling each ... well... crashes everything. The docker containers running the app started being restarted for a simple data error.

Line where the nil to_date parameter could be checked:

I understand that it's a fault at the app level, but I'd prefer the library rejects a nil that would never work.
Most probably other funcitions in the gem are affected by the same issue.

Happy to submit a PR, but wanted to check if it makes sense.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions