equiv fix for issue 1899
diff --git a/include/rapidjson/uri.h b/include/rapidjson/uri.h
index 6b80147..6353c32 100644
--- a/include/rapidjson/uri.h
+++ b/include/rapidjson/uri.h
@@ -62,7 +62,7 @@
 #endif
 
     //! Copy constructor
-    GenericUri(const GenericUri& rhs) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(rhs.allocator_), ownAllocator_() {
+    GenericUri(const GenericUri& rhs) : uri_(), base_(), scheme_(), auth_(), path_(), query_(), frag_(), allocator_(), ownAllocator_() {
         *this = rhs;
     }
 
@@ -101,19 +101,19 @@
     }
 
     const Ch* GetString() const { return uri_; }
-    SizeType GetStringLength() const { return internal::StrLen<Ch>(uri_); }
+    SizeType GetStringLength() const { return uri_ == 0 ? 0 : internal::StrLen<Ch>(uri_); }
     const Ch* GetBaseString() const { return base_; }
-    SizeType GetBaseStringLength() const { return internal::StrLen<Ch>(base_); }
+    SizeType GetBaseStringLength() const { return base_ == 0 ? 0 : internal::StrLen<Ch>(base_); }
     const Ch* GetSchemeString() const { return scheme_; }
-    SizeType GetSchemeStringLength() const { return internal::StrLen<Ch>(scheme_); }
+    SizeType GetSchemeStringLength() const { return scheme_ == 0 ? 0 : internal::StrLen<Ch>(scheme_); }
     const Ch* GetAuthString() const { return auth_; }
-    SizeType GetAuthStringLength() const { return internal::StrLen<Ch>(auth_); }
+    SizeType GetAuthStringLength() const { return auth_ == 0 ? 0 : internal::StrLen<Ch>(auth_); }
     const Ch* GetPathString() const { return path_; }
-    SizeType GetPathStringLength() const { return internal::StrLen<Ch>(path_); }
+    SizeType GetPathStringLength() const { return path_ == 0 ? 0 : internal::StrLen<Ch>(path_); }
     const Ch* GetQueryString() const { return query_; }
-    SizeType GetQueryStringLength() const { return internal::StrLen<Ch>(query_); }
+    SizeType GetQueryStringLength() const { return query_ == 0 ? 0 : internal::StrLen<Ch>(query_); }
     const Ch* GetFragString() const { return frag_; }
-    SizeType GetFragStringLength() const { return internal::StrLen<Ch>(frag_); }
+    SizeType GetFragStringLength() const { return frag_ == 0 ? 0 : internal::StrLen<Ch>(frag_); }
 
 #if RAPIDJSON_HAS_STDSTRING
     static String Get(const GenericUri& uri) { return String(uri.GetString(), uri.GetStringLength()); }
diff --git a/test/unittest/uritest.cpp b/test/unittest/uritest.cpp
index 7fa7b93..6cfa27d 100644
--- a/test/unittest/uritest.cpp
+++ b/test/unittest/uritest.cpp
@@ -29,6 +29,26 @@
 
 using namespace rapidjson;
 
+TEST(Uri, DefaultConstructor) {
+    typedef GenericUri<Value> UriType;
+    UriType u;
+    EXPECT_TRUE(u.GetSchemeString() == 0);
+    EXPECT_TRUE(u.GetAuthString() == 0);
+    EXPECT_TRUE(u.GetPathString() == 0);
+    EXPECT_TRUE(u.GetBaseString() == 0);
+    EXPECT_TRUE(u.GetQueryString() == 0);
+    EXPECT_TRUE(u.GetFragString() == 0);
+    EXPECT_TRUE(u.GetString() == 0);
+    EXPECT_TRUE(u.GetSchemeStringLength() == 0);
+    EXPECT_TRUE(u.GetAuthStringLength() == 0);
+    EXPECT_TRUE(u.GetPathStringLength() == 0);
+    EXPECT_TRUE(u.GetBaseStringLength() == 0);
+    EXPECT_TRUE(u.GetQueryStringLength() == 0);
+    EXPECT_TRUE(u.GetFragStringLength() == 0);
+    EXPECT_TRUE(u.GetStringLength() == 0);
+}
+
+
 TEST(Uri, Parse) {
     typedef GenericUri<Value, MemoryPoolAllocator<> > UriType;
     MemoryPoolAllocator<CrtAllocator> allocator;
@@ -256,6 +276,27 @@
     EXPECT_TRUE(u.GetFragStringLength() == len);
 }
 
+TEST(Uri, CopyConstructor) {
+    typedef GenericUri<Value> UriType;
+    CrtAllocator allocator;
+
+    UriType u("http://auth/path/xxx?query#frag", &allocator);
+    UriType u2(u);
+    EXPECT_TRUE(u == u2);
+    EXPECT_NE(&u.GetAllocator(), &u2.GetAllocator());
+}
+
+TEST(Uri, Assignment) {
+    typedef GenericUri<Value> UriType;
+    CrtAllocator allocator;
+
+    UriType u("http://auth/path/xxx?query#frag", &allocator);
+    UriType u2;
+    u2 = u;
+    EXPECT_TRUE(u == u2);
+    EXPECT_NE(&u.GetAllocator(), &u2.GetAllocator());
+}
+
 TEST(Uri, Resolve) {
     typedef GenericUri<Value> UriType;
     CrtAllocator allocator;
@@ -648,6 +689,15 @@
     EXPECT_FALSE(d.Match(a));
 }
 
+TEST(Uri, Issue1899) {
+    typedef GenericUri<Value, MemoryPoolAllocator<> > UriType;
+
+    UriType base = UriType("http://auth/path/#frag");
+    UriType ref = UriType("http://newauth/newpath#newfrag");
+    UriType res = ref.Resolve(base);
+    EXPECT_TRUE(StrCmp(res.GetString(), "http://newauth/newpath#newfrag") == 0);
+}
+
 #if defined(_MSC_VER) || defined(__clang__)
 RAPIDJSON_DIAG_POP
 #endif