Skip to content

Commit

Permalink
fixed NPE; support for 2023.1; v1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
brandl committed Jun 9, 2023
1 parent 9bbb09c commit 90f1dc3
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changes

## [Unreleased]
## [1.3.0]

Fixed NPE when using 2023.1

## [1.2.11]
- Updated Dependencies
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dependencies {

// Set the JVM language level used to build the project. Use Java 11 for 2020.3+, and Java 17 for 2022.2+.
kotlin {
jvmToolchain(11)
jvmToolchain(17)
}

// Configure Gradle IntelliJ Plugin - read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
pluginGroup = org.jetbrains.plugins.template
pluginName = PasteImages
pluginRepositoryUrl = https://github.com/holgerbrandl/pasteimages
pluginVersion = 1.2.11
pluginVersion = 1.3.0

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 221
pluginSinceBuild = 231
pluginUntilBuild = 231.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2022.1.4
platformVersion = 2023.1.2

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
16 changes: 10 additions & 6 deletions src/main/java/img2md/PasteImageHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,17 @@ protected void doExecute(@NotNull Editor editor, @Nullable Caret caret, DataCont
if (virtualFile != null) {
FileType fileType = virtualFile.getFileType();
if ("Markdown".equals(fileType.getName())) {
Image imageFromClipboard = ImageUtils.getImageFromClipboard().image;
if (imageFromClipboard != null) {
ImageWithInfo imageFromClipboard1 = ImageUtils.getImageFromClipboard();
if(imageFromClipboard1!=null) {

Image imageFromClipboard = imageFromClipboard1.image;
if (imageFromClipboard != null) {
// assert caret == null : "Invocation of 'paste' operation for specific caret is not supported";
PasteImageFromClipboard action = new PasteImageFromClipboard();
AnActionEvent event = createAnEvent(action, dataContext);
action.actionPerformed(event);
return;
PasteImageFromClipboard action = new PasteImageFromClipboard();
AnActionEvent event = createAnEvent(action, dataContext);
action.actionPerformed(event);
return;
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.github.holgerbrandl.pasteimages/</id>
<name>Paste Images into Markdown</name>
<version>1.2.6</version>
<version>1.3.0</version>
<vendor email="[email protected]" url="https://github.com/holgerbrandl/pasteimages"/>
<vendor>Holger Brandl</vendor>

Expand Down

0 comments on commit 90f1dc3

Please sign in to comment.