Skip to content

Commit c5900c8

Browse files
johaven7185
authored andcommitted
refactor(frontend:files): use optional chaining (language?.name) to avoid null errors
1 parent c7c0d96 commit c5900c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/src/app/applications/files/components/viewers/files-viewer-text.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class FilesViewerTextComponent implements OnInit, OnDestroy {
4545
ngOnInit() {
4646
const language: LanguageDescription = LanguageDescription.matchFilename(languages, this.file.name)
4747
if (language?.name || this.file.size <= this.maxSize) {
48-
this.currentLanguage = language.name
48+
this.currentLanguage = language?.name
4949
this.http.get(this.file.dataUrl, { responseType: 'text' }).subscribe((data: string) => (this.content = data))
5050
} else {
5151
this.content = this.layout.translateString('This file contains binary data that can not be read')

0 commit comments

Comments
 (0)