This commit is contained in:
Redkale
2017-12-21 16:50:21 +08:00
parent a1c0bbf413
commit 9b656b3970

View File

@@ -124,7 +124,7 @@ public class RetResult<T> {
*/
public RetResult<T> attach(String key, Object value) {
if (this.attach == null) this.attach = new HashMap<>();
boolean canstr = value instanceof CharSequence || value.getClass().isPrimitive();
boolean canstr = value != null && (value instanceof CharSequence || value.getClass().isPrimitive());
this.attach.put(key, value == null ? null : (canstr ? String.valueOf(value) : JsonConvert.root().convertTo(value)));
return this;
}