You've already forked focalboard
mirror of
https://github.com/mattermost/focalboard.git
synced 2025-07-03 23:30:29 +02:00
Return JSON empty array when not found, and handle null arrays
This commit is contained in:
@ -218,7 +218,7 @@ func (s *SQLStore) GetAllBlocks() ([]model.Block, error) {
|
|||||||
func blocksFromRows(rows *sql.Rows) ([]model.Block, error) {
|
func blocksFromRows(rows *sql.Rows) ([]model.Block, error) {
|
||||||
defer rows.Close()
|
defer rows.Close()
|
||||||
|
|
||||||
var results []model.Block
|
var results = []model.Block{}
|
||||||
|
|
||||||
for rows.Next() {
|
for rows.Next() {
|
||||||
var block model.Block
|
var block model.Block
|
||||||
|
@ -28,7 +28,8 @@ class OctoClient {
|
|||||||
private async getJson(response: Response, defaultValue: any = {}): Promise<any> {
|
private async getJson(response: Response, defaultValue: any = {}): Promise<any> {
|
||||||
// The server may return null or malformed json
|
// The server may return null or malformed json
|
||||||
try {
|
try {
|
||||||
return await response.json()
|
const value = await response.json()
|
||||||
|
return value || defaultValue
|
||||||
} catch {
|
} catch {
|
||||||
return defaultValue
|
return defaultValue
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user