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

On (really old) Kindles, don't crash if there's no sysfs entry to rea… #5161

Merged
merged 1 commit into from Aug 1, 2019

Conversation

@NiLuJe
Copy link
Member

commented Aug 1, 2019

…d for battery capacity

Parse gasgaucge-info's output instead.

Fix #5159

On (really old) Kindles, don't crash if there's no sysfs entry to rea…
…d for battery capacity

Parse gasgaucge-info's output instead.

Fix #5159

@Frenzie Frenzie added the Kindle label Aug 1, 2019

@Frenzie Frenzie added this to the 2019.08 milestone Aug 1, 2019

@Frenzie

Frenzie approved these changes Aug 1, 2019

std_out:close()
return result and tonumber(result) or 0
else
return 0

This comment has been minimized.

Copy link
@Frenzie

Frenzie Aug 1, 2019

Member

Could potentially be easier to read if you just stick it at the end? (Not asking for a change, result is the same either way.)

This comment has been minimized.

Copy link
@NiLuJe

NiLuJe Aug 1, 2019

Author Member

I'm not sure I get what you mean. Stick what at the end of what? ^^.

This comment has been minimized.

Copy link
@Frenzie

Frenzie Aug 1, 2019

Member

I mean you can either write:

if bla then
  return lala
else
  return 0
end

or

if bla then
  lala
end
return 0

I find the latter slightly quicker to understand as a default fallback return value, but perhaps I just like that it's quicker to write. /shrugs

This comment has been minimized.

Copy link
@Frenzie

Frenzie Aug 1, 2019

Member

So in this case right before the function's end.

This comment has been minimized.

Copy link
@NiLuJe

NiLuJe Aug 1, 2019

Author Member

Oh ;).

Yeah, I'd have gone with the full verbose, explicit pyramid, but then I checked what get_int_property did, and I kind of liked it ;p.

@NiLuJe NiLuJe merged commit 53adb9d into koreader:master Aug 1, 2019

1 check passed

ci/circleci: build Your tests passed on CircleCI!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.