mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 23:38:32 +00:00
prevent crashing when selected file is not audio
This commit is contained in:
parent
4eb49ca90d
commit
29dc1a4d02
1 changed files with 3 additions and 2 deletions
|
@ -138,6 +138,7 @@ function Modal({ modalProps }: { modalProps: ModalProps; }) {
|
||||||
const [blobUrl, setBlobUrl] = useObjectUrl();
|
const [blobUrl, setBlobUrl] = useObjectUrl();
|
||||||
|
|
||||||
const setAudioBlob = blob => {
|
const setAudioBlob = blob => {
|
||||||
|
if (!blob.type.startsWith("audio/")) return;
|
||||||
setBlob(blob);
|
setBlob(blob);
|
||||||
setBlobUrl(blob);
|
setBlobUrl(blob);
|
||||||
};
|
};
|
||||||
|
@ -187,13 +188,13 @@ function Modal({ modalProps }: { modalProps: ModalProps; }) {
|
||||||
|| blob.type.includes("codecs") && !blob.type.includes("opus")
|
|| blob.type.includes("codecs") && !blob.type.includes("opus")
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleDrop = async (event) => {
|
const handleDrop = async event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
const file = event.dataTransfer.files[0];
|
const file = event.dataTransfer.files[0];
|
||||||
if (file) setAudioBlob(file);
|
if (file) setAudioBlob(file);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDragOver = (event) => {
|
const handleDragOver = event => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue