From a7418a62d6511a9441e35589382f1339ab4e53bf Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Tue, 9 Apr 2019 16:01:27 +0200 Subject: [PATCH] e2lib: misuse of warnf() should trigger an assertion Signed-off-by: Tobias Ulmer --- generic/e2lib.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 5b0c831..d634ee2 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -686,13 +686,11 @@ end -- @param ... arguments required for the format string -- @return nil function e2lib.warnf(category, format, ...) - if (format:len() == 0) or (not format) then - e2lib.log(1, "Internal error: calling warnf() with zero length format") - end - if type(e2lib.globals.warn_category[category]) ~= "boolean" then - e2lib.log(1, - "Internal error: calling warnf() with invalid warning category") - end + assertIsStringN(format, + "Internal error: called warnf() with invalid format") + assertIsBoolean(e2lib.globals.warn_category[category], + "Internal error: called warnf() with invalid warning category") + if e2lib.globals.warn_category[category] == true then local prefix = "Warning: " if e2lib.globals.log_debug then -- 2.39.5