mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
bridgev2/commands: fix panic when creating group with no arguments
This commit is contained in:
parent
34a65d3087
commit
33d8d658fe
1 changed files with 8 additions and 2 deletions
|
|
@ -80,8 +80,14 @@ var CommandStartChat = &FullHandler{
|
|||
}
|
||||
|
||||
func getClientForStartingChat[T bridgev2.IdentifierResolvingNetworkAPI](ce *Event, thing string) (*bridgev2.UserLogin, T, []string) {
|
||||
remainingArgs := ce.Args[1:]
|
||||
login := ce.Bridge.GetCachedUserLoginByID(networkid.UserLoginID(ce.Args[0]))
|
||||
var remainingArgs []string
|
||||
if len(ce.Args) > 1 {
|
||||
remainingArgs = ce.Args[1:]
|
||||
}
|
||||
var login *bridgev2.UserLogin
|
||||
if len(ce.Args) > 0 {
|
||||
login = ce.Bridge.GetCachedUserLoginByID(networkid.UserLoginID(ce.Args[0]))
|
||||
}
|
||||
if login == nil || login.UserMXID != ce.User.MXID {
|
||||
remainingArgs = ce.Args
|
||||
login = ce.User.GetDefaultLogin()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue