From 82c1d69c65ff2439d8eb0ceab7fe57e065a5f555 Mon Sep 17 00:00:00 2001 From: tmpz23 <28760271+tmpz23@users.noreply.github.com> Date: Mon, 10 Jan 2022 22:42:22 +0100 Subject: [PATCH] Update gcmtool.py fix align check --- gcmtool.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcmtool.py b/gcmtool.py index 7489ada..863e998 100644 --- a/gcmtool.py +++ b/gcmtool.py @@ -158,7 +158,7 @@ class FstTree: node.set_offset(self.__current_file_offset) self.__fst_block += node.format() self.__current_file_offset += node.size() - if self.__align != 0 and self.__current_file_offset % self.__align != 0: + if self.__current_file_offset % self.__align != 0: self.__current_file_offset += self.__align - (self.__current_file_offset % self.__align) def get_fst(self): self.__current_file_offset += self.__get_fst_length() @@ -421,5 +421,7 @@ if __name__ == '__main__': gcm.unpack( p_input, p_output ) elif args.rebuild_fst: logging.info("### Rebuilding FST") + if args.align < 1: + raise Exception("Align must be > 0") logging.info(f"Using alignment : {args.align}") gcm.rebuild_fst(p_input, args.align)