Cannot read properties of null (reading ‘style’) at X [duplicate]

Similar to what I did in other parts of the document and worked, I was trying to hide the delete button if an user isn’t logged in or in other profile. However, I get this message “Uncaught (in promise) TypeError: Cannot read properties of null (reading ‘style’)
at showEditDelete”, pointing to the delete deleteBtn.display.style

async function showEditDelete() {
let deleteBtn = document.getElementById("delete-col");
let currentProfileId = await usersAPI_auto.getById(userId);
let loggedUserId = sessionManager.getLoggedUser().userId;
if (sessionManager.isLogged()){
    if (loggedUserId != currentProfileId){
        deleteBtn.style.display = "none"
    }
} else {
    deleteBtn.style.display = "none";  
}

}