Skip to content

SmythOS Studio: Open-Source Visual AI Agent Builder and deployable runtime stack from SmythOS. Start with an intuitive drag-and-drop workspace, extend with custom code, and deploy your agents anywhere — local, cloud, or edge — with full governance and control.

Refactor: Enhance null safety in debugger component

Muhammad Hamza Khan184afd72a161
diff --git a/packages/app/src/builder-ui/debugger.ts b/packages/app/src/builder-ui/debugger.ts
index 05e5ce1d..23b12e71 100644
--- a/packages/app/src/builder-ui/debugger.ts
+++ b/packages/app/src/builder-ui/debugger.ts
@@ -2069,7 +2069,7 @@ export async function processDebugStep(debugInfo, agentID, sessionID?, IDFilter?
typeof output['_error'] == 'string'
? output['_error']
: JSON.stringify(output['_error']);
- aiFixBtn.setAttribute('data-error', dataError);
+ aiFixBtn?.setAttribute('data-error', dataError);
}
} else {
componentElement.classList.remove('state-error');
@@ -2088,7 +2088,7 @@ export async function processDebugStep(debugInfo, agentID, sessionID?, IDFilter?
if (output['_debug_time']) {
const debugBar = componentElement.querySelector('.debug-bar');
- debugBar.setAttribute('debug-time', output['_debug_time'] + 'ms');
+ debugBar?.setAttribute('debug-time', output['_debug_time'] + 'ms');
}
//dettach from component and attach it to workspace.domElement while preserving the initial position
@@ -3321,7 +3321,7 @@ function toggleDebugBarVisibility(componentElement: HTMLElement) {
if (debugBar) {
const isAnyButtonVisible =
(debugLogBtn && !debugLogBtn.classList.contains('hidden')) ||
- (aiFixBtn && !aiFixBtn.classList.contains('hidden'));
+ (aiFixBtn && !aiFixBtn?.classList.contains('hidden'));
(debugBar as HTMLElement).style.display = isAnyButtonVisible ? '' : 'none';
}
}