[Tdbc] Fix static analysis issue (#6228)
authorjeremy-jang <35089715+jeremy-jang@users.noreply.github.com>
Wed, 24 Jul 2024 08:15:56 +0000 (17:15 +0900)
committerGitHub <noreply@github.com>
Wed, 24 Jul 2024 08:15:56 +0000 (17:15 +0900)
System.Reflection.Assembly.CreateInstance() can return null value.

Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
src/Tizen.Data.Tdbc/Tizen.Data.Tdbc/DriverManager.cs

index d7c1e113e5cfbb4b50bd3bea129341f270c0bf10..690f6dbb74bc344128c52555da210ec4b0c3219c 100644 (file)
@@ -58,6 +58,11 @@ namespace Tizen.Data.Tdbc
                 throw new SystemException("Failed to open connection due to: " + ex);
             }
 
+            if (conn == null)
+            {
+                throw new SystemException("Failed to open connection");
+            }
+
             conn.Open(uri);
             return conn;
         }
@@ -90,6 +95,11 @@ namespace Tizen.Data.Tdbc
                 throw new SystemException("Failed to open connection due to: " + ex);
             }
 
+            if (conn == null)
+            {
+                throw new SystemException("Failed to open connection");
+            }
+
             conn.Open(connectionString);
             return conn;
         }