Skip to content

Commit fddcd60

Browse files
committed
fix: server crash whenever someone gets their password wrong
1 parent 98f9cd7 commit fddcd60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

twitterv1/twitterv1.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,13 @@ func MobileClientApiDecider(c *fiber.Ctx) error {
198198
}
199199

200200
func EncodeAndSend(c *fiber.Ctx, data interface{}) error {
201+
var ok bool
201202
encodeType := c.Params("filetype")
202203
if encodeType == "" {
203-
encodeType = c.Locals("filetype").(string)
204+
encodeType, ok = c.Locals("filetype").(string)
205+
if !ok {
206+
encodeType = "json"
207+
}
204208
}
205209
switch encodeType {
206210
case "xml":

0 commit comments

Comments
 (0)