From 7e8032c61e5c47f4e50b03dcf98c3b20dd5a8e55 Mon Sep 17 00:00:00 2001 From: Skye Im Date: Mon, 11 Mar 2024 13:44:46 +0100 Subject: [PATCH] Check g.x_arg exists before working on it (#541) --- 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):