From ade0d75b4caca0220901bdfd31b261b05f3200f4 Mon Sep 17 00:00:00 2001 From: Skye Im Date: Mon, 11 Mar 2024 13:16:27 +0100 Subject: [PATCH] Check g.x_arg exists before working on it --- src/flask_migrate/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flask_migrate/__init__.py b/src/flask_migrate/__init__.py index d12a097..197f17b 100644 --- a/src/flask_migrate/__init__.py +++ b/src/flask_migrate/__init__.py @@ -93,7 +93,7 @@ def get_config(self, directory=None, x_arg=None, opts=None): setattr(config.cmd_opts, opt, True) if not hasattr(config.cmd_opts, 'x'): setattr(config.cmd_opts, 'x', []) - for x in g.x_arg: + for x in getattr(g, 'x_arg', []): config.cmd_opts.x.append(x) if x_arg is not None: if isinstance(x_arg, list) or isinstance(x_arg, tuple):