From df3ca4100bcc4ff3c25aa20a08704144d7214d4f Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 11 Jan 2021 20:14:03 +0100 Subject: [PATCH 1/2] [caps] Check for null in EntityCapsManager.addCapsExtension() To avoid a NPE, we check for null in addCapsExtension. Fixes SMACK-899. --- .../org/jivesoftware/smackx/caps/EntityCapsManager.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index b776cf8a4..523213513 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -312,7 +312,10 @@ public final class EntityCapsManager extends Manager { // XEP-0115 specifies that a client SHOULD include entity capabilities // with every presence notification it sends. private void addCapsExtension(PresenceBuilder presenceBuilder) { - CapsVersionAndHash capsVersionAndHash = getCapsVersionAndHash(); + final CapsVersionAndHash capsVersionAndHash = getCapsVersionAndHash(); + if (capsVersionAndHash == null) { + return; + } CapsExtension caps = new CapsExtension(entityNode, capsVersionAndHash.version, capsVersionAndHash.hash); presenceBuilder.overrideExtension(caps); } @@ -434,10 +437,10 @@ public final class EntityCapsManager extends Manager { } /** - * Get our own caps version. The version depends on the enabled features. + * Get our own caps version or {@code null} if none is yet set. The version depends on the enabled features. * A caps version looks like '66/0NaeaBKkwk85efJTGmU47vXI=' * - * @return our own caps version + * @return our own caps version or {@code null}. */ public CapsVersionAndHash getCapsVersionAndHash() { return currentCapsVersion; From 8cc4ba0a42f827679c83f951373c4ce21d494fff Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Tue, 12 Jan 2021 09:06:24 +0100 Subject: [PATCH 2/2] [README] Switch "build status" badge from Travis to Github Actions This also renames the CI workflow from "Smack CI" to just "CI". --- .github/workflows/ci.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa8c140b8..ddaf29404 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Smack CI +name: CI env: GRADLE_VERSION: 6.7.1 diff --git a/README.md b/README.md index 4ffef04bd..42a6ebf3c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ Smack ===== -[![Build Status](https://api.travis-ci.com/igniterealtime/Smack.svg?branch=master)](https://travis-ci.com/github/igniterealtime/Smack) [![Coverage Status](https://coveralls.io/repos/igniterealtime/Smack/badge.svg)](https://coveralls.io/r/igniterealtime/Smack) [![Project Stats](https://www.openhub.net/p/smack/widgets/project_thin_badge.gif)](https://www.openhub.net/p/smack) [![Link to XMPP chat smack@conference.igniterealtime.org](https://inverse.chat/badge.svg?room=smack@conference.igniterealtime.org)](https://inverse.chat/#converse/room?jid=smack@conference.igniterealtime.org) +[![Build Status](https://github.com/igniterealtime/Smack/workflows/CI/badge.svg)](https://github.com/igniterealtime/Smack/actions?query=workflow%3A%22CI%22) [![Coverage Status](https://coveralls.io/repos/igniterealtime/Smack/badge.svg)](https://coveralls.io/r/igniterealtime/Smack) [![Project Stats](https://www.openhub.net/p/smack/widgets/project_thin_badge.gif)](https://www.openhub.net/p/smack) [![Link to XMPP chat smack@conference.igniterealtime.org](https://inverse.chat/badge.svg?room=smack@conference.igniterealtime.org)](https://inverse.chat/#converse/room?jid=smack@conference.igniterealtime.org) About -----