Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slot may null #1712

Merged
merged 1 commit into from
Jul 10, 2023
Merged

fix slot may null #1712

merged 1 commit into from
Jul 10, 2023

Conversation

Mixficsol
Copy link
Collaborator

fix #1686

std::shared_ptr<Slot> slot;
slot = g_pika_server->GetSlotByDBName(db_name_);
Do(slot);
}

bool Cmd::is_read() const { return ((flag_ & kCmdFlagsMaskRW) == kCmdFlagsRead); }
bool Cmd::is_write() const { return ((flag_ & kCmdFlagsMaskRW) == kCmdFlagsWrite); }
Copy link

Choose a reason for hiding this comment

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

Based on the provided code patch, here is a brief code review:

  1. In the ProcessDoNotSpecifySlotCmd() function, a shared pointer slot is created and initialized with the result of calling GetSlotByDBName() method on g_pika_server object.

    • Suggestion: Since slot is unused after this assignment, you may consider removing it and directly pass the result of GetSlotByDBName() to the Do() method.
  2. Assuming Do() method accepts a std::shared_ptr<Slot> as its argument, the change from Do() to Do(slot) in the ProcessDoNotSpecifySlotCmd() function seems appropriate and should work fine.

  3. The rest of the code snippet doesn't indicate any immediate bug risks or improvements.

Overall, the code modifications appear reasonable, but without further context or knowledge of the surrounding codebase, it's difficult to assess potential issues thoroughly. It's advisable to perform comprehensive testing to ensure the changes integrate correctly with the existing code and achieve the desired functionality.

@Mixficsol Mixficsol merged commit b21fc14 into OpenAtomFoundation:unstable Jul 10, 2023
8 checks passed
@Mixficsol Mixficsol deleted the fix-slot-null branch July 19, 2023 03:29
bigdaronlee163 pushed a commit to bigdaronlee163/pika that referenced this pull request Jun 8, 2024
cheniujh pushed a commit to cheniujh/pika that referenced this pull request Sep 24, 2024
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.

cmd::Do中未传入slot会导致空指针错误
3 participants