Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-08-04 08:30:14 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-08-04 08:30:14 +0400
commita270481239f7f8befc5b68056c56f5e2363e4027 (patch)
tree40c684d334477147edc3c88961596afd8cac6f83 /intern/rigidbody
parentfee152d0ec4284982d80177dd0a6eb3fc9e9a6f0 (diff)
add missing NULL check in RB_dworld_export if fopen fails.
Diffstat (limited to 'intern/rigidbody')
-rw-r--r--intern/rigidbody/rb_bullet_api.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index 58e355c0d52..5724d1992d9 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -57,6 +57,7 @@ subject to the following restrictions:
*/
#include <stdio.h>
+#include <errno.h>
#include "RBI_api.h"
@@ -218,8 +219,13 @@ void RB_dworld_export(rbDynamicsWorld *world, const char *filename)
world->dynamicsWorld->serialize(serializer);
FILE *file = fopen(filename, "wb");
- fwrite(serializer->getBufferPointer(), serializer->getCurrentBufferSize(), 1, file);
- fclose(file);
+ if (file) {
+ fwrite(serializer->getBufferPointer(), serializer->getCurrentBufferSize(), 1, file);
+ fclose(file);
+ }
+ else {
+ fprintf(stderr, "RB_dworld_export: %s\n", strerror(errno));
+ }
}
/* ********************************** */