File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,23 @@ import { dispatch } from '../state/store'
9
9
10
10
export async function getAppIcons ( apps : Storage [ 'apps' ] ) : Promise < void > {
11
11
try {
12
- const buffers : Buffer [ ] = await fileIcon . buffer (
13
- apps . map ( ( app ) => app . id ) ,
14
- { size : 64 } ,
15
- )
12
+ const buffers : ( Buffer | null ) [ ] = [ ]
13
+
14
+ for await ( const app of apps ) {
15
+ try {
16
+ const buffer = await fileIcon . buffer ( app . id , { size : 64 } )
17
+ buffers . push ( buffer )
18
+ } catch {
19
+ buffers . push ( null )
20
+ }
21
+ }
16
22
17
23
const icons : Partial < Record < AppId , string > > = { }
18
24
19
25
for ( const [ index , buffer ] of Object . entries ( buffers ) ) {
20
- icons [ apps [ Number ( index ) ] . id ] = `data:image/png;base64, ${ buffer . toString (
21
- 'base64' ,
22
- ) } `
26
+ icons [ apps [ Number ( index ) ] . id ] = buffer
27
+ ? `data:image/png;base64, ${ buffer . toString ( 'base64' ) } `
28
+ : ''
23
29
}
24
30
25
31
dispatch ( gotAppIcons ( icons ) )
You can’t perform that action at this time.
0 commit comments