Skip to content

Commit e6ecb5d

Browse files
Merge pull request #2740 from nextcloud/backport/2738/stable-4.4
[stable-4.4] BugFix - Empty Note Content
2 parents 08115c5 + 5a6dd7a commit e6ecb5d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

app/src/main/java/it/niedermann/owncloud/notes/persistence/NotesRepository.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -544,10 +544,15 @@ public Map<Long, Long> getIdMap(long accountId) {
544544
public void toggleFavoriteAndSync(Account account, Note note) {
545545
executor.submit(() -> {
546546
try {
547+
final var noteWithContent = getNoteById(note.getId());
548+
if (noteWithContent == null) {
549+
return;
550+
}
551+
547552
final var ssoAccount = AccountImporter.getSingleSignOnAccount(context, account.getAccountName());
548553
final var notesAPI = apiProvider.getNotesAPI(context, ssoAccount, getPreferredApiVersion(account.getApiVersion()));
549-
note.setFavorite(!note.getFavorite());
550-
final var result = notesAPI.updateNote(note);
554+
noteWithContent.setFavorite(!noteWithContent.getFavorite());
555+
final var result = notesAPI.updateNote(noteWithContent);
551556
final var response = result.execute();
552557
if (response.isSuccessful()) {
553558
final var updatedNote = response.body();

0 commit comments

Comments
 (0)