openvidu-react-native: Fixed crash with JSON parse

This commit is contained in:
csantosm 2021-01-26 13:45:23 +01:00
parent 59438d2bf9
commit d7b607c25a

View File

@ -176,9 +176,11 @@ export default class App extends Component<Props> {
getNicknameTag(stream) {
// Gets the nickName of the user
if (stream.connection && JSON.parse(stream.connection.data) && JSON.parse(stream.connection.data).clientData) {
return JSON.parse(stream.connection.data).clientData;
}
try {
if (stream.connection && JSON.parse(stream.connection.data) && JSON.parse(stream.connection.data).clientData) {
return JSON.parse(stream.connection.data).clientData;
}
} catch (error) { }
return '';
}