From 7353da3fa038b0cb33c877126f805e2194d1dc26 Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Thu, 27 Jun 2019 14:22:20 +0200 Subject: [PATCH] Psycopg2: Assure index exists before referencing --- instana/instrumentation/psycopg2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instana/instrumentation/psycopg2.py b/instana/instrumentation/psycopg2.py index d2fb7a13..555d82b0 100644 --- a/instana/instrumentation/psycopg2.py +++ b/instana/instrumentation/psycopg2.py @@ -20,7 +20,7 @@ def register_type_with_instana(wrapped, instance, args, kwargs): args_clone = list(copy.copy(args)) - if hasattr(args_clone[1], '__wrapped__'): + if (len(args_clone) >= 2) and (args_clone[1], '__wrapped__'): args_clone[1] = args_clone[1].__wrapped__ return wrapped(*args_clone, **kwargs)