Skip to content

Commit 9c9885f

Browse files
chore: code improvements
1 parent 0e62184 commit 9c9885f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

packages/appkit/src/AppKit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ export class AppKit {
257257
if (!connection || !connection.adapter || !connection.adapter.connector) return null;
258258

259259
try {
260-
return connection.adapter.connector.getProvider() as T;
260+
return connection.adapter.connector.getProvider() as T | null;
261261
} catch (error) {
262262
// Provider not initialized yet during session restoration
263263
// This can happen on app restart when restoring a previous connection

packages/appkit/src/hooks/useProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ export function useProvider(): ProviderResult {
4040
const { connection } = useSnapshot(ConnectionsController.state);
4141

4242
const returnValue = useMemo(() => {
43-
if (!connection) return { provider: undefined, providerType: undefined };
43+
if (!connection || !connection.adapter) {
44+
return { provider: undefined, providerType: undefined };
45+
}
4446

4547
try {
4648
return {

0 commit comments

Comments
 (0)