Merge pull request #2005 from keepassxreboot/fix/options_remove_connection

Add some extra checks when removing a connection
This commit is contained in:
Sami Vänttinen 2023-10-11 18:02:59 +03:00 committed by GitHub
commit f54e16ec3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -15,7 +15,8 @@ kpxcEvent.onMessage = async function(request, sender) {
kpxcEvent.showStatus = async function(tab, configured, internalPoll) {
let keyId = null;
if (configured && keepass.databaseHash !== '') {
if (configured && keepass.databaseHash !== ''
&& Object.hasOwn(keepass.databaseHash, keepass.databaseHash)) {
keyId = keepass.keyRing[keepass.databaseHash].id;
}
@ -91,7 +92,7 @@ kpxcEvent.onGetStatus = async function(tab, args = []) {
kpxcEvent.onReconnect = async function(tab) {
const configured = await keepass.reconnect(tab);
if (configured) {
browser.tabs.sendMessage(tab.id, {
browser.tabs.sendMessage(tab?.id, {
action: 'redetect_fields'
}).catch((err) => {
logError(err);

View file

@ -370,7 +370,11 @@ options.initConnectedDatabases = function() {
const closestTr = this.closest('tr');
$('#dialogDeleteConnectedDatabase').setAttribute('hash', closestTr.getAttribute('hash'));
$('#dialogDeleteConnectedDatabase').setAttribute('tr-id', closestTr.getAttribute('id'));
$('#dialogDeleteConnectedDatabase .modal-body strong').textContent = closestTr.children[0].textContent;
const identifier = $('#dialogDeleteConnectedDatabase .modal-body strong');
if (identifier) {
identifier.textContent = closestTr.children[0].textContent;
}
dialogDeleteConnectedDatabaseModal.show();
$('#dialogDeleteConnectedDatabase').addEventListener('shown.bs.modal', function(modalEvent) {