Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow empty replies from Resrobot server #272

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

f03el
Copy link

@f03el f03el commented Dec 13, 2018

Sometimes, the server reply can be empty and still valid. This is for example the case with time table replies when there are no departures from a station (or at least not any departures matching the selected direction).

In order to do this change, I had to modify the signature of parseJson() to return a QVariant instead of a QVariantMap, so callers can check if the parsing succeeded in a better way than looking whether the returned map is empty. For symmetry, I also changed serializeToJson() correspondingly.

The other two backends using parseJson() (Matka and NineTwo) have been left with unchanged behaviour, since I'd rather not fix them unless broken.

Should solve #267.

@smurfy Please review.

Erik Lundin added 2 commits December 13, 2018 21:57
Allows callers to parseJson() to check whether the parsing failed. Since
an empty JSON object was returned if the parsing failed, there was no
way to know if the input string was "{}" or if the parsing failed.
Sometimes, the server reply can be empty and still valid. This is for
example the case with time table replies when there are no departures
from a station (or at least not any departures matching the selected
direction).

Fixes smurfy#267.
@f03el
Copy link
Author

f03el commented Apr 4, 2019

@smurfy Bump. Do you think it's possible to merge this? As mentioned above, I hope to close issue #267.

@smurfy
Copy link
Owner

smurfy commented Apr 4, 2019

hi, sorry, i'm busy with other stuff and also need to reinstall all my QT versions. To test.
If you like i can grant you write permission to the repo

@f03el
Copy link
Author

f03el commented Apr 4, 2019

No worries. I totally understand if you are busy and know it can be difficult to find the time for spare time projects like this. If you think it's feasible, I would be honoured to get write access to the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants