From 41e57fccd24af4f3816cea73852c64f78f28235e Mon Sep 17 00:00:00 2001 From: Robert-Jan de Dreu Date: Mon, 28 Feb 2022 16:50:18 +0100 Subject: [PATCH] Fix Pocketbook crashes when filename is nil (#8823) Function `SetSubtaskInfo` takes only chars as a valid book. Since filename can be `nil` (not a char) the crash would happen. This Change avoids the crash by using a char type nil value. See: `int SetSubtaskInfo(int task, int subtask, const char *name, const char *book);` Fixes #8053 Fixes #8392 too Fixes #8743 last issue --- frontend/device/pocketbook/device.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/device/pocketbook/device.lua b/frontend/device/pocketbook/device.lua index d3cbae725..e0379ad55 100644 --- a/frontend/device/pocketbook/device.lua +++ b/frontend/device/pocketbook/device.lua @@ -5,6 +5,7 @@ local C = ffi.C local inkview = ffi.load("inkview") local band = require("bit").band local util = require("util") +local _ = require("gettext") require("ffi/posix_h") require("ffi/linux_input_h") @@ -268,7 +269,7 @@ function PocketBook:notifyBookState(title, document) fo:write(fn) fo:close() end - inkview.SetSubtaskInfo(inkview.GetCurrentTask(), 0, title and (title .. " - koreader") or "koreader", fn) + inkview.SetSubtaskInfo(inkview.GetCurrentTask(), 0, title and (title .. " - koreader") or "koreader", fn or _("N/A")) end function PocketBook:setDateTime(year, month, day, hour, min, sec)