fix occasionally failed lipc invocation

pull/78/head
chrox 11 years ago
parent 9589e5c54d
commit a60cfc4e10

@ -11,7 +11,9 @@ function ReaderFrontLight:init()
if dev_mod == "KindlePaperWhite" then
require "liblipclua"
self.lipc_handle = lipc.init("com.github.koreader")
self.intensity = self.lipc_handle:get_int_property("com.lab126.powerd", "flIntensity")
if self.lipc_handle then
self.intensity = self.lipc_handle:get_int_property("com.lab126.powerd", "flIntensity")
end
end
self.ges_events = {
Adjust = {
@ -29,7 +31,7 @@ function ReaderFrontLight:init()
end
function ReaderFrontLight:onAdjust(arg, ges)
if self.lipc_handle then
if self.lipc_handle and self.intensity ~=nil then
local rel_proportion = ges.distance / Screen:getWidth()
local delta_int = self.steps[math.ceil(#self.steps*rel_proportion)]
local msg = ""

Loading…
Cancel
Save