summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-05-20 18:04:06 -0300
committerVinicius Costa Gomes <vinicius.gomes@openbossa.org>2010-05-21 13:52:00 -0300
commit2f126779a05ca2604d35ca6badf0bd21ce1a4db6 (patch)
treed9786e7ef9ccd082b6b8b053d8f86e407c816aed
parentbc4044e8ebf4daeadafc1484c7200d189337214d (diff)
downloadobexd-2f126779a05ca2604d35ca6badf0bd21ce1a4db6.tar.gz
Fix crash when receiving small objects
When the received object fits in only one packet, when we reach obex_read_stream we may not have the driver. We must wait the driver to be set before writing.
-rw-r--r--src/obex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/obex.c b/src/obex.c
index a39a48d..38ff438 100644
--- a/src/obex.c
+++ b/src/obex.c
@@ -332,7 +332,8 @@ static int obex_read_stream(struct obex_session *os, obex_t *obex,
if (os->size == OBJECT_SIZE_DELETE)
os->size = OBJECT_SIZE_UNKNOWN;
- if (os->pending > 0)
+ /* If there's something to write and we are able to write it */
+ if (os->pending > 0 && os->driver)
goto write;
size = OBEX_ObjectReadStream(obex, obj, &buffer);