Skip to content

Conversation

@FrozenAlex
Copy link
Contributor

@FrozenAlex FrozenAlex commented Aug 28, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Fixed rare crashes during multiplayer status updates by safely handling unexpected data formats, improving overall stability.
  • Chores

    • Updated BeatSaver++ dependency to ^0.2.3.
    • Refreshed and realigned multiple supporting libraries to newer versions with updated build configurations for improved compatibility and maintenance.
    • No changes to public interfaces.

@coderabbitai
Copy link

coderabbitai bot commented Aug 28, 2025

Walkthrough

Updated qpm.json to bump beatsaverplusplus to ^0.2.3. Overhauled qpm.shared.json restored dependency graph with multiple renames, additions, version changes, and build option adjustments. Added try-catch and logging around JSON deserialization in MultiplayerStatusModelHooks.cpp, returning nullptr on exception.

Changes

Cohort / File(s) Summary
Top-level dependency bump
qpm.json
Update beatsaverplusplus versionRange from ^0.2.2 to ^0.2.3.
Restored dependencies graph overhaul
qpm.shared.json
Extensive remap of restored dependencies: multiple ID renames, additions (e.g., scotland2, paper2_scotland2), version updates, branchName changes, headersOnly/cmake toggles, and compileOptions adjustments (includePaths/systemIncludes, cppFlags). Added restored beatsaverplusplus 0.2.3 with linkage data.
Runtime error handling in JSON parse
src/Hooks/MultiplayerStatusModelHooks.cpp
Wrap non-CUSTOM JsonUtility_FromJson call in try-catch; on exception, log warning, print 40-frame backtrace, and return nullptr. No signature changes.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Game
  participant Hook as MultiplayerStatusModelHooks
  participant JsonUtil as JsonUtility

  Game->>Hook: Parse MultiplayerStatusData (value, info)
  alt CUSTOM type
    Hook->>JsonUtil: FromJson(CUSTOM)
    JsonUtil-->>Hook: statusData
    Hook-->>Game: statusData
  else Non-CUSTOM type
    rect rgba(230,240,255,0.6)
    note right of Hook: New behavior: try/catch around FromJson
    Hook->>JsonUtil: FromJson(non-CUSTOM)
    JsonUtil-->>Hook: statusData
    Hook-->>Game: statusData
    end
    opt Exception thrown
      Hook-->>Hook: Log warning + print 40-frame backtrace
      Hook-->>Game: nullptr
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I thump my paws—new deps in line,
A tidy bump to version nine.
If JSON trips, I won’t despair,
I trace the stack with careful care.
With carrots, logs, and nulls to spare,
This bunny ships what’s true and fair. 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbit in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbit in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbit gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbit read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbit help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbit ignore or @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbit summary or @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbit or @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Hooks/MultiplayerStatusModelHooks.cpp (1)

23-24: Null-deref risk in DEBUG prints (method_inst->type_argc).

Both sites access method_inst->type_argc without null-check; will segfault when method_inst is null.

Apply:

-    DEBUG("JsonConvert_DeserializeObject_MultiplayerStatusData check:  ptr method_inst='{}', type_argc='{}', ptr type_argv='{}'", fmt::ptr(method_inst), method_inst->type_argc, fmt::ptr(method_inst ? method_inst->type_argv : nullptr));
+    {
+        const auto argc = method_inst ? method_inst->type_argc : 0u;
+        DEBUG("JsonConvert_DeserializeObject_MultiplayerStatusData check:  ptr method_inst='{}', type_argc='{}', ptr type_argv='{}'",
+              fmt::ptr(method_inst), argc, fmt::ptr(method_inst ? method_inst->type_argv : nullptr));
+    }
-    DEBUG("JsonUtility_FromJson_MultiplayerStatusData check:  ptr method_inst='{}', type_argc='{}', ptr type_argv='{}'", fmt::ptr(method_inst), method_inst->type_argc, fmt::ptr(method_inst ? method_inst->type_argv : nullptr));
+    {
+        const auto argc = method_inst ? method_inst->type_argc : 0u;
+        DEBUG("JsonUtility_FromJson_MultiplayerStatusData check:  ptr method_inst='{}', type_argc='{}', ptr type_argv='{}'",
+              fmt::ptr(method_inst), argc, fmt::ptr(method_inst ? method_inst->type_argv : nullptr));
+    }

Also applies to: 50-51

🧹 Nitpick comments (1)
src/Hooks/MultiplayerStatusModelHooks.cpp (1)

30-33: Mirror the try/catch for the Newtonsoft.Json path too.

Invalid JSON via JsonConvert.DeserializeObject can crash similarly. Wrap the orig call like the Unity path.

-        // call orig here, remember to pass the info parameter to your orig call!
-        return JsonConvert_DeserializeObject_MultiplayerStatusData(value, info);
+        try {
+            return JsonConvert_DeserializeObject_MultiplayerStatusData(value, info);
+        } catch (const std::exception& e) {
+            WARNING("JsonConvert_DeserializeObject_MultiplayerStatusData exception: {}", e.what());
+            Paper::Logger::Backtrace(40);
+            return nullptr;
+        } catch (...) {
+            WARNING("JsonConvert_DeserializeObject_MultiplayerStatusData exception caught; returning nullptr");
+            Paper::Logger::Backtrace(40);
+            return nullptr;
+        }

Please confirm upstream call sites tolerate nullptr for both FromJson and DeserializeObject paths (no immediate deref).

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4dbb9fc and e77f9ea.

📒 Files selected for processing (3)
  • qpm.json (1 hunks)
  • qpm.shared.json (5 hunks)
  • src/Hooks/MultiplayerStatusModelHooks.cpp (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/Hooks/MultiplayerStatusModelHooks.cpp (2)
src/Models/MpStatusData.cpp (1)
  • New (92-159)
shared/Models/MpStatusData.hpp (1)
  • DECLARE_CLASS_CODEGEN (6-52)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
qpm.json (1)

121-123: Approve bump of beatsaverplusplus to ^0.2.3 — qpm.json and qpm.shared.json are in sync and restore produced version 0.2.3; no further action needed.

src/Hooks/MultiplayerStatusModelHooks.cpp (1)

58-66: Add empty-input guard and log std::exception::what()

  • Early-return if value is null or empty
  • Catch std::exception first to log e.what(), then fallback to catch(...)
    Verify whether IL2CPP-managed exceptions from UnityEngine.JsonUtility propagate into native C++ catches in your hook environment; if not, switch to an il2cpp-aware invoke API to report errors instead of throwing through C++.
qpm.shared.json (2)

122-124: Top-level beatsaverplusplus ^0.2.3 — in sync with qpm.json and restored.

Looks consistent with restored version 0.2.3 below.


136-144: Restored dependencies and include paths verified. All top-level dependencies have matching restored entries; bs-cordl uses “include”, fmt uses “fmt/include/”, and paper2_scotland2 uses “shared/utfcpp/source” as expected.

@michael-r-elp michael-r-elp merged commit 49c00ae into EnderdracheLP:master Aug 28, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants