From 25be6cff876be4b29cb7de9866d3ab1c2b7e18e1 Mon Sep 17 00:00:00 2001 From: padreug Date: Mon, 5 Jan 2026 11:11:19 +0100 Subject: [PATCH] Fix LNbits 1.4 compatibility: add null guards for g.user.wallets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LNbits 1.4 changed g.user initialization (PR #3615), moving it from windowMixin to base.html. This means g.user can be null during initial Vue template evaluation. - Use optional chaining g.user?.wallets || [] in template - Add null guard before accessing this.g.user.wallets in JS 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- static/js/index.js | 4 ++-- templates/satmachineadmin/index.html | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/static/js/index.js b/static/js/index.js index ee3e587..687db7d 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -181,13 +181,13 @@ window.app = Vue.createApp({ this.lamassuConfig = data // When opening config dialog, populate the selected wallets if they exist - if (data && data.source_wallet_id) { + if (data && data.source_wallet_id && this.g.user?.wallets) { const wallet = this.g.user.wallets.find(w => w.id === data.source_wallet_id) if (wallet) { this.configDialog.data.selectedWallet = wallet } } - if (data && data.commission_wallet_id) { + if (data && data.commission_wallet_id && this.g.user?.wallets) { const commissionWallet = this.g.user.wallets.find(w => w.id === data.commission_wallet_id) if (commissionWallet) { this.configDialog.data.selectedCommissionWallet = commissionWallet diff --git a/templates/satmachineadmin/index.html b/templates/satmachineadmin/index.html index 46eef37..83de8c7 100644 --- a/templates/satmachineadmin/index.html +++ b/templates/satmachineadmin/index.html @@ -547,17 +547,17 @@ - +