File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
app/src/main/java/ch/skew/remotrix/works Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -209,8 +209,15 @@ class SendMsgWorker(
209209 if (current == senderNumber) {
210210 val nameIndex = contacts.getColumnIndex(ContactsContract .CommonDataKinds .Phone .DISPLAY_NAME )
211211 val pictureIndex = contacts.getColumnIndex(ContactsContract .CommonDataKinds .Phone .PHOTO_URI )
212- picUri = Uri .parse(contacts.getString(pictureIndex))
213- roomName = contacts.getString(nameIndex)
212+ if (pictureIndex >= 0 ) {
213+ val uri = contacts.getString(pictureIndex)
214+ if (uri != = null ) picUri = Uri .parse(uri)
215+ }
216+ if (nameIndex >= 0 ){
217+ val name = contacts.getString(nameIndex)
218+ if (name != = null ) roomName = name
219+ }
220+
214221 break
215222 }
216223 }
@@ -245,7 +252,7 @@ class SendMsgWorker(
245252 val length = stream.available()
246253 client.api.media.upload(
247254 Media (
248- ByteReadChannel (stream.readAllBytes ()),
255+ ByteReadChannel (stream.readBytes ()),
249256 contentLength = length.toLong(),
250257 filename = roomName,
251258 contentType = ContentType (" image" , " jpeg" )
You can’t perform that action at this time.
0 commit comments