Skip to content

Commit

Permalink
Handle crash when clipboard-copying empty JWT (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
novotnyr committed Oct 30, 2017
1 parent 2290b97 commit fa7a21c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/com/github/novotnyr/idea/jwt/JwtExplorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ private void configureToolbar() {
group.add(new AnAction("Copy as JSON", "Copy JWT to clipboard as JSON", AllIcons.FileTypes.Json) {
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
ClipboardUtils.copyPayload(JwtExplorer.this.jwt);
Jwt jwt = JwtExplorer.this.jwt;
if (jwt != null) {
ClipboardUtils.copyPayload(JwtExplorer.this.jwt);
}
}
});

Expand Down
3 changes: 3 additions & 0 deletions src/com/github/novotnyr/idea/jwt/JwtPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ private void editClaimAtRow(int row) {


private void onCopyAsJsonActionPerformed(AnActionEvent anActionEvent) {
if (this.jwt == null) {
return;
}
TextTransferable textTransferable = new TextTransferable(JwtHelper.prettyUnbase64Json(this.jwt.getPayloadString()));
CopyPasteManagerEx.getInstanceEx().setContents(textTransferable);
}
Expand Down

0 comments on commit fa7a21c

Please sign in to comment.