Skip to content

Commit c91c85f

Browse files
check for current before loading the buttons
1 parent 1ae7a48 commit c91c85f

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

dist/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,11 @@ var load = function load(component, product) {
4141
config.id = id;
4242
}
4343

44-
component.buttons.current.id = config.id;
44+
if (component.buttons.current) {
45+
component.buttons.current.id = config.id;
4546

46-
window.__sharethis__.load(product, config);
47+
window.__sharethis__.load(product, config);
48+
}
4749

4850
if (_onShareThisLoaded) {
4951
_onShareThisLoaded();

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sharethis-reactjs",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "sharethis reactjs plugins",
55
"main": "dist/index.js",
66
"author": "ShareThis <support@sharethis.com> (https://sharethis.com)",

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ const load = function(component, product) {
1616
const id = 'sharethis-' + Date.now();
1717
config.id = id;
1818
}
19-
component.buttons.current.id = config.id;
20-
window.__sharethis__.load(product, config);
19+
if (component.buttons.current) {
20+
component.buttons.current.id = config.id;
21+
window.__sharethis__.load(product, config);
22+
}
2123
if (_onShareThisLoaded) {
2224
_onShareThisLoaded();
2325
}

0 commit comments

Comments
 (0)