Skip to content

Commit

Permalink
fix: add error handling on file name and extension unwrapping.
Browse files Browse the repository at this point in the history
  • Loading branch information
shuotwang committed Oct 20, 2022
1 parent 5cac92c commit 5353e63
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/ui/chats/chat/message_tile/file_bubble.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:path_provider/path_provider.dart';
import 'package:vocechat_client/app.dart';
import 'package:vocechat_client/app_consts.dart';
import 'package:vocechat_client/ui/chats/chat/message_tile/tile_pages/file_page.dart';

Expand All @@ -29,7 +30,13 @@ class FileBubble extends StatelessWidget {
}

final filename = p.basename(name);
final extension = p.extension(name).substring(1);
String extension;
try {
extension = p.extension(name).substring(1);
} catch (e) {
App.logger.severe(e);
extension = "";
}
Widget svgPic;

if (_isAudio(extension)) {
Expand Down

0 comments on commit 5353e63

Please sign in to comment.