From a60cfc4e10afb804bcd0da832472b3566cd73b31 Mon Sep 17 00:00:00 2001 From: chrox Date: Sat, 20 Apr 2013 11:08:12 +0800 Subject: [PATCH] fix occasionally failed lipc invocation --- frontend/ui/reader/readerfrontlight.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/ui/reader/readerfrontlight.lua b/frontend/ui/reader/readerfrontlight.lua index 5ec22c1f9..498340704 100644 --- a/frontend/ui/reader/readerfrontlight.lua +++ b/frontend/ui/reader/readerfrontlight.lua @@ -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 = ""