Skip to content

Commit 00a762b

Browse files
committed
fix: additional null and empty checks
1 parent feb0304 commit 00a762b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/io/supertokens/storage/postgresql/queries/BulkImportQueries.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public static String getQueryToCreatePaginationIndex2(Start start) {
7676

7777
public static void insertBulkImportUsers_Transaction(Start start, Connection connection, AppIdentifier appIdentifier, List<BulkImportUser> users)
7878
throws SQLException, StorageQueryException {
79+
if(users == null || users.isEmpty()){
80+
return;
81+
}
7982
String queryBuilder = "INSERT INTO " + Config.getConfig(start).getBulkImportUsersTable() +
8083
" (id, app_id, raw_data, created_at, updated_at) VALUES "
8184
+ " (?, ?, ?, ?, ?)";
@@ -118,6 +121,9 @@ public static void updateBulkImportUserStatus_Transaction(Start start, Connectio
118121
public static void updateMultipleBulkImportUsersStatusToError_Transaction(Start start, Connection con, AppIdentifier appIdentifier,
119122
@Nonnull Map<String,String> bulkImportUserIdToErrorMessage)
120123
throws SQLException, StorageQueryException {
124+
if(bulkImportUserIdToErrorMessage == null || bulkImportUserIdToErrorMessage.isEmpty()){
125+
return;
126+
}
121127
BULK_IMPORT_USER_STATUS errorStatus = BULK_IMPORT_USER_STATUS.FAILED;
122128
String query = "UPDATE " + Config.getConfig(start).getBulkImportUsersTable()
123129
+ " SET status = ?, error_msg = ?, updated_at = ? WHERE app_id = ? and id = ?";

0 commit comments

Comments
 (0)