summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 016ec040ac8..cb18201042a 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -372,7 +372,10 @@ Slice::JavaVisitor::writeHashCode(Output& out, const TypePtr& type, const string
ConstructedPtr constructed = ConstructedPtr::dynamicCast(type);
assert(constructed);
+ out << nl << "if(" << name << " != null)";
+ out << sb;
out << nl << "__h = 5 * __h + " << name << ".hashCode();";
+ out << eb;
}
void