backport of a thread bugfix from 2_5_X branch Daniel

* threads.c: backport of a thread bugfix from 2_5_X branch
Daniel
diff --git a/threads.c b/threads.c
index fd03e66..c646449 100644
--- a/threads.c
+++ b/threads.c
@@ -235,8 +235,10 @@
  * xmlRMutexLock() is used to lock a libxml2 token_r.
  */
 void
-xmlRMutexLock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
+xmlRMutexLock(xmlRMutexPtr tok)
 {
+    if (tok == NULL)
+        return;
 #ifdef HAVE_PTHREAD_H
     pthread_mutex_lock(&tok->lock);
     if (tok->held) {
@@ -269,6 +271,8 @@
 void
 xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
 {
+    if (tok == NULL)
+        return;
 #ifdef HAVE_PTHREAD_H
     pthread_mutex_lock(&tok->lock);
     tok->held--;