mirror of
https://github.com/ralsina/tartrazine.git
synced 2025-05-23 16:40:08 -03:00
enry-java: allow empty file contents
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
This commit is contained in:
parent
b020f78841
commit
9a36e8f398
@ -58,7 +58,7 @@ class GoUtils {
|
|||||||
static GoSlice.ByValue toGoByteSlice(byte[] bytes) {
|
static GoSlice.ByValue toGoByteSlice(byte[] bytes) {
|
||||||
int length = 0;
|
int length = 0;
|
||||||
Pointer ptr = null;
|
Pointer ptr = null;
|
||||||
if (bytes != null) {
|
if (bytes != null && bytes.length > 0) {
|
||||||
length = bytes.length;
|
length = bytes.length;
|
||||||
ptr = ptrFromBytes(bytes);
|
ptr = ptrFromBytes(bytes);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ public class EnryTest {
|
|||||||
@Test
|
@Test
|
||||||
public void getLanguageWithEmptyContent() {
|
public void getLanguageWithEmptyContent() {
|
||||||
assertEquals("Go", Enry.getLanguage("baz.go", "".getBytes()));
|
assertEquals("Go", Enry.getLanguage("baz.go", "".getBytes()));
|
||||||
|
assertEquals("Go", Enry.getLanguage("baz.go", null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
x
Reference in New Issue
Block a user