Fix Simulator crash with empty library#2433
Fix Simulator crash with empty library#2433dnicolson wants to merge 1 commit intoProvenance-Emu:developfrom
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
User description
This fixes a crash because a Realm instance is expected:
Provenance/PVUI/Sources/PVUIBase/SwiftUI/Components/GameContextMenu.swift
Line 40 in ffbdff6
This only occurs in the Simulator with an empty library:
Provenance/PVUI/Sources/PVSwiftUI/Consoles/ConsoleGamesView.swift
Line 1087 in d99a189
PR Type
Bug fix
Description
Fix Simulator crash when library is empty
Ensure Realm instance exists in mock game generation
Wrap mock game creation in Realm write transaction
Properly add generated games to Realm database
Diagram Walkthrough
File Walkthrough
PVGame.swift
Add Realm transaction to mock game generationPVLibrary/Sources/PVRealm/RealmPlatform/Entities/PVGame.swift
mockGeneratemethodrealm.writetransaction blockrealm.add(game)publishDateto use current index instead of count